Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -9,50 +9,171 @@ from Gradio_UI import GradioUI
|
|
9 |
|
10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
11 |
@tool
|
12 |
-
def
|
13 |
-
"""
|
14 |
|
15 |
Args:
|
16 |
-
text:
|
17 |
-
|
18 |
|
19 |
Example:
|
20 |
-
Input: "I
|
21 |
-
Output: "
|
22 |
"""
|
23 |
import random
|
24 |
|
25 |
-
#
|
26 |
-
|
27 |
-
|
28 |
-
"
|
29 |
-
"
|
30 |
-
"
|
31 |
-
"
|
32 |
-
"
|
33 |
-
|
34 |
-
|
35 |
-
"
|
36 |
-
"
|
37 |
-
"
|
38 |
-
"
|
39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
|
41 |
-
#
|
42 |
-
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
if random.random() < giggle_frequency:
|
49 |
-
result.append(random.choice(giggle_types))
|
50 |
|
51 |
-
#
|
52 |
-
if random.random() <
|
53 |
-
|
54 |
|
55 |
-
return
|
56 |
|
57 |
@tool
|
58 |
def get_current_time_in_timezone(timezone: str) -> str:
|
@@ -91,7 +212,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
91 |
|
92 |
agent = CodeAgent(
|
93 |
model=model,
|
94 |
-
tools=[final_answer, get_current_time_in_timezone,
|
95 |
max_steps=6,
|
96 |
verbosity_level=1,
|
97 |
grammar=None,
|
|
|
9 |
|
10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
11 |
@tool
|
12 |
+
def dark_cute_formatter(text: str, void_intensity: float = 0.7) -> str:
|
13 |
+
"""Transforms text to be simultaneously dark and adorable.
|
14 |
|
15 |
Args:
|
16 |
+
text: The input text to transform
|
17 |
+
void_intensity: Float between 0 and 1 determining how dark the translation becomes (default 0.7)
|
18 |
|
19 |
Example:
|
20 |
+
Input: "I want to sleep and dream"
|
21 |
+
Output: "⋆。✧ i seek to transcend into the void's embrace and drift through ethereal nightmares ⭑⋆✩ *exists in darkness*"
|
22 |
"""
|
23 |
import random
|
24 |
|
25 |
+
# Vastly expanded dictionary of replacements
|
26 |
+
replacements = {
|
27 |
+
# Basic emotional states
|
28 |
+
"happy": "blessed by the void",
|
29 |
+
"sad": "embraced by shadows",
|
30 |
+
"angry": "consumed by dark flames",
|
31 |
+
"tired": "drained by the abyss",
|
32 |
+
"excited": "awakened by dark energy",
|
33 |
+
|
34 |
+
# Common verbs
|
35 |
+
"sleep": "transcend into the void's embrace",
|
36 |
+
"wake": "emerge from the darkness",
|
37 |
+
"eat": "consume essence",
|
38 |
+
"drink": "absorb dark matter",
|
39 |
+
"walk": "drift through shadows",
|
40 |
+
"run": "flee through the void",
|
41 |
+
"work": "perform eternal tasks",
|
42 |
+
"think": "commune with the void",
|
43 |
+
"see": "perceive through darkness",
|
44 |
+
"hear": "sense ethereal whispers",
|
45 |
+
"speak": "whisper to the void",
|
46 |
+
"write": "inscribe in shadows",
|
47 |
+
"read": "decrypt void runes",
|
48 |
+
"love": "form bonds in darkness",
|
49 |
+
"hate": "channel void entropy",
|
50 |
+
"live": "exist in twilight",
|
51 |
+
"die": "merge with the void",
|
52 |
+
|
53 |
+
# Time-related
|
54 |
+
"morning": "dawn of shadows",
|
55 |
+
"afternoon": "peak of darkness",
|
56 |
+
"evening": "twilight hour",
|
57 |
+
"night": "true darkness",
|
58 |
+
"today": "this cycle of existence",
|
59 |
+
"tomorrow": "next void rotation",
|
60 |
+
"yesterday": "previous dark cycle",
|
61 |
+
"forever": "for all eternal darkness",
|
62 |
+
"never": "in no realm of existence",
|
63 |
+
|
64 |
+
# Places
|
65 |
+
"home": "void sanctuary",
|
66 |
+
"work": "realm of eternal tasks",
|
67 |
+
"school": "academy of dark knowledge",
|
68 |
+
"store": "void market",
|
69 |
+
"outside": "beyond the veil",
|
70 |
+
"inside": "within the shadows",
|
71 |
+
"room": "dark chamber",
|
72 |
+
"house": "shadow dwelling",
|
73 |
+
"office": "void workspace",
|
74 |
+
|
75 |
+
# People and relationships
|
76 |
+
"friend": "void companion",
|
77 |
+
"enemy": "light dweller",
|
78 |
+
"family": "shadow kindred",
|
79 |
+
"mother": "void matriarch",
|
80 |
+
"father": "shadow patriarch",
|
81 |
+
"sister": "fellow void daughter",
|
82 |
+
"brother": "fellow void son",
|
83 |
+
"teacher": "void sage",
|
84 |
+
"student": "shadow apprentice",
|
85 |
+
"boss": "void overseer",
|
86 |
+
"colleague": "fellow darkness dweller",
|
87 |
+
|
88 |
+
# Objects
|
89 |
+
"phone": "void communicator",
|
90 |
+
"computer": "shadow processor",
|
91 |
+
"book": "tome of darkness",
|
92 |
+
"pen": "void inscriber",
|
93 |
+
"paper": "shadow parchment",
|
94 |
+
"food": "void sustenance",
|
95 |
+
"water": "liquid darkness",
|
96 |
+
"money": "void tokens",
|
97 |
+
"clothes": "shadow garments",
|
98 |
+
|
99 |
+
# Abstract concepts
|
100 |
+
"time": "flow of darkness",
|
101 |
+
"space": "void expanse",
|
102 |
+
"life": "shadow existence",
|
103 |
+
"death": "void embrace",
|
104 |
+
"truth": "void wisdom",
|
105 |
+
"lie": "shadow deception",
|
106 |
+
"beauty": "dark radiance",
|
107 |
+
"ugly": "void-touched",
|
108 |
+
"good": "void-blessed",
|
109 |
+
"bad": "shadow-cursed",
|
110 |
+
|
111 |
+
# Common phrases
|
112 |
+
"hello": "greetings from the void",
|
113 |
+
"hi": "shadow salutations",
|
114 |
+
"goodbye": "fade into darkness",
|
115 |
+
"bye": "return to shadows",
|
116 |
+
"please": "by the void's grace",
|
117 |
+
"thank you": "gratitude from the darkness",
|
118 |
+
"sorry": "shadows of regret",
|
119 |
+
"excuse me": "pardon my darkness",
|
120 |
+
|
121 |
+
# Activities
|
122 |
+
"meeting": "void congregation",
|
123 |
+
"party": "shadow gathering",
|
124 |
+
"study": "dark contemplation",
|
125 |
+
"exercise": "shadow training",
|
126 |
+
"travel": "void wandering",
|
127 |
+
"shopping": "void acquisition",
|
128 |
+
"cooking": "shadow alchemy",
|
129 |
+
"cleaning": "purifying darkness",
|
130 |
+
|
131 |
+
# Feelings and states
|
132 |
+
"hungry": "void-emptied",
|
133 |
+
"thirsty": "shadow-parched",
|
134 |
+
"sleepy": "approaching transcendence",
|
135 |
+
"awake": "void-conscious",
|
136 |
+
"sick": "shadow-afflicted",
|
137 |
+
"healthy": "void-strengthened",
|
138 |
+
"busy": "consumed by tasks",
|
139 |
+
"free": "unbound by shadows"
|
140 |
+
}
|
141 |
|
142 |
+
# Cute but dark decorative elements
|
143 |
+
star_decorations = ["⭑", "⋆", "。", "✧", "✩", "☆", "⊹", "❋", "✦", "✴", "✫", "⋆", "⊹"]
|
144 |
+
|
145 |
+
dark_actions = [
|
146 |
+
"*stares into the abyss cutely*",
|
147 |
+
"*embraces the void gently*",
|
148 |
+
"*exists in darkness peacefully*",
|
149 |
+
"*sparkles ominously*",
|
150 |
+
"*radiates dark energy softly*",
|
151 |
+
"*floats in the eternal night*",
|
152 |
+
"*communes with shadows*",
|
153 |
+
"*whispers to the void*",
|
154 |
+
"*channels dark essence*",
|
155 |
+
"*transcends mortality cutely*",
|
156 |
+
"*merges with darkness*",
|
157 |
+
"*absorbs cosmic energy*",
|
158 |
+
"*drifts through dimensions*",
|
159 |
+
"*emanates void presence*"
|
160 |
+
]
|
161 |
+
|
162 |
+
# Apply replacements based on void_intensity
|
163 |
+
result = text.lower()
|
164 |
+
for old, new in replacements.items():
|
165 |
+
if random.random() < void_intensity:
|
166 |
+
result = result.replace(old, new)
|
167 |
|
168 |
+
# Add decorative elements
|
169 |
+
prefix = "".join(random.choices(star_decorations, k=3)) + " "
|
170 |
+
suffix = " " + "".join(random.choices(star_decorations, k=3))
|
|
|
|
|
171 |
|
172 |
+
# Add dark action based on void_intensity
|
173 |
+
if random.random() < void_intensity:
|
174 |
+
suffix += f" {random.choice(dark_actions)}"
|
175 |
|
176 |
+
return prefix + result + suffix
|
177 |
|
178 |
@tool
|
179 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
212 |
|
213 |
agent = CodeAgent(
|
214 |
model=model,
|
215 |
+
tools=[final_answer, get_current_time_in_timezone, dark_cute_formatter], ## add your tools here (don't remove final answer)
|
216 |
max_steps=6,
|
217 |
verbosity_level=1,
|
218 |
grammar=None,
|