Spaces:
Sleeping
Sleeping
Update app.py
Browse filesAdded cool_speak tool
app.py
CHANGED
|
@@ -4,19 +4,45 @@ import requests
|
|
| 4 |
import pytz
|
| 5 |
import yaml
|
| 6 |
from tools.final_answer import FinalAnswerTool
|
| 7 |
-
|
| 8 |
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 |
-
"""A tool that does nothing yet
|
| 15 |
Args:
|
| 16 |
-
|
| 17 |
-
arg2: the second argument
|
| 18 |
"""
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
@tool
|
| 22 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
|
| 4 |
import pytz
|
| 5 |
import yaml
|
| 6 |
from tools.final_answer import FinalAnswerTool
|
| 7 |
+
import re
|
| 8 |
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 cool_speak(speech_text:str)-> str:
|
| 13 |
+
"""A tool that makes your speech much cooler
|
|
|
|
| 14 |
Args:
|
| 15 |
+
speech_text: Input speech text to be translated to cool talk
|
|
|
|
| 16 |
"""
|
| 17 |
+
cool_mapping = {
|
| 18 |
+
'hello': 'yo',
|
| 19 |
+
'bye': 'peace out!',
|
| 20 |
+
'man': 'homie',
|
| 21 |
+
'money': 'moolah',
|
| 22 |
+
'brother': 'bro',
|
| 23 |
+
'sister': 'sis',
|
| 24 |
+
'boss': 'big chief',
|
| 25 |
+
'everyone': 'the crew',
|
| 26 |
+
'understand': 'vibe with',
|
| 27 |
+
'hurry': 'step on it',
|
| 28 |
+
'leave': 'bounce',
|
| 29 |
+
'sleep': 'crash',
|
| 30 |
+
'work': 'the grind',
|
| 31 |
+
'house': 'crib',
|
| 32 |
+
'car': 'whip',
|
| 33 |
+
'shoes': 'kicks',
|
| 34 |
+
'food': 'grub',
|
| 35 |
+
'clothes': 'threads'
|
| 36 |
+
}
|
| 37 |
+
coolified = []
|
| 38 |
+
words_of_interest = set(cool_mapping.keys())
|
| 39 |
+
words = re.sub(r'[^a-z\s]', '', speech_text.lower()).split()
|
| 40 |
+
for word in words:
|
| 41 |
+
if word in words_of_interest:
|
| 42 |
+
coolified.append(cool_mapping[word])
|
| 43 |
+
else:
|
| 44 |
+
coolified.append(word)
|
| 45 |
+
return ' '.join(coolified)
|
| 46 |
|
| 47 |
@tool
|
| 48 |
def get_current_time_in_timezone(timezone: str) -> str:
|