Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,40 +9,50 @@ 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 |
-
Each word will start with a lowercase letter, followed by alternating uppercase and lowercase letters.
|
| 15 |
|
| 16 |
Args:
|
| 17 |
-
text: The input text
|
|
|
|
| 18 |
|
| 19 |
Example:
|
| 20 |
-
Input: "
|
| 21 |
-
Output: "
|
| 22 |
"""
|
| 23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
words = text.split()
|
|
|
|
| 25 |
|
| 26 |
-
# Process each word
|
| 27 |
-
silly_words = []
|
| 28 |
for word in words:
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
# Capitalize every other letter starting from index 1
|
| 38 |
-
for i in range(1, len(chars), 2):
|
| 39 |
-
chars[i] = chars[i].upper()
|
| 40 |
-
|
| 41 |
-
# Join the characters back into a word
|
| 42 |
-
silly_words.append(''.join(chars))
|
| 43 |
|
| 44 |
-
|
| 45 |
-
return ' '.join(silly_words)
|
| 46 |
|
| 47 |
@tool
|
| 48 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
@@ -81,7 +91,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 81 |
|
| 82 |
agent = CodeAgent(
|
| 83 |
model=model,
|
| 84 |
-
tools=[final_answer, get_current_time_in_timezone,
|
| 85 |
max_steps=6,
|
| 86 |
verbosity_level=1,
|
| 87 |
grammar=None,
|
|
|
|
| 9 |
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 11 |
@tool
|
| 12 |
+
def creepy_hehes(text: str, giggle_frequency: float = 0.3) -> str:
|
| 13 |
+
"""Adds "hehe" randomly throughout the text with varying styles, used in every conversation.
|
|
|
|
| 14 |
|
| 15 |
Args:
|
| 16 |
+
text: The input text to add giggles to
|
| 17 |
+
giggle_frequency: Float between 0 and 1 determining how often to add giggles (default 0.3)
|
| 18 |
|
| 19 |
Example:
|
| 20 |
+
Input: "I am writing some code today"
|
| 21 |
+
Output: "I am hehehe writing some code (hehe) today heHEHE"
|
| 22 |
"""
|
| 23 |
+
import random
|
| 24 |
+
|
| 25 |
+
# Different styles of "hehe"
|
| 26 |
+
giggle_types = [
|
| 27 |
+
" hehe ",
|
| 28 |
+
" HEHE ",
|
| 29 |
+
" heHEhe ",
|
| 30 |
+
" (hehe) ",
|
| 31 |
+
" *hehe* ",
|
| 32 |
+
" hehehe ",
|
| 33 |
+
" heheHE ",
|
| 34 |
+
" HEhehe ",
|
| 35 |
+
" ~hehe~ ",
|
| 36 |
+
" (◔◡◔) hehe ",
|
| 37 |
+
" heh ",
|
| 38 |
+
" teehee ",
|
| 39 |
+
]
|
| 40 |
+
|
| 41 |
+
# Split text into words
|
| 42 |
words = text.split()
|
| 43 |
+
result = []
|
| 44 |
|
|
|
|
|
|
|
| 45 |
for word in words:
|
| 46 |
+
result.append(word)
|
| 47 |
+
# Randomly decide whether to add a giggle after this word
|
| 48 |
+
if random.random() < giggle_frequency:
|
| 49 |
+
result.append(random.choice(giggle_types))
|
| 50 |
+
|
| 51 |
+
# Sometimes add a final hehe
|
| 52 |
+
if random.random() < 0.3:
|
| 53 |
+
result.append(random.choice(giggle_types))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
|
| 55 |
+
return ''.join(result)
|
|
|
|
| 56 |
|
| 57 |
@tool
|
| 58 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
|
| 91 |
|
| 92 |
agent = CodeAgent(
|
| 93 |
model=model,
|
| 94 |
+
tools=[final_answer, get_current_time_in_timezone, creepy_hehes], ## add your tools here (don't remove final answer)
|
| 95 |
max_steps=6,
|
| 96 |
verbosity_level=1,
|
| 97 |
grammar=None,
|