Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -11,14 +11,20 @@ from Gradio_UI import GradioUI
|
|
| 11 |
|
| 12 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 13 |
@tool
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
"""
|
|
|
|
| 17 |
Args:
|
| 18 |
-
|
| 19 |
-
arg2: the second argument
|
| 20 |
"""
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
@tool
|
| 24 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
@@ -59,7 +65,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 59 |
|
| 60 |
agent = CodeAgent(
|
| 61 |
model=model,
|
| 62 |
-
tools=[final_answer,get_current_time_in_timezone,visit_webpage], ## add your tools here (don't remove final answer)
|
| 63 |
max_steps=6,
|
| 64 |
verbosity_level=1,
|
| 65 |
grammar=None,
|
|
|
|
| 11 |
|
| 12 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 13 |
@tool
|
| 14 |
+
@tool
|
| 15 |
+
def text_to_speech(text: str) -> str:
|
| 16 |
+
"""Converts the given text to speech and returns a success message.
|
| 17 |
+
|
| 18 |
Args:
|
| 19 |
+
text: The text to be converted to speech.
|
|
|
|
| 20 |
"""
|
| 21 |
+
try:
|
| 22 |
+
engine = pyttsx3.init() # Initialize the speech engine
|
| 23 |
+
engine.say(text) # Speak the text
|
| 24 |
+
engine.runAndWait() # Wait for the speech to complete
|
| 25 |
+
return "Text successfully converted to speech."
|
| 26 |
+
except Exception as e:
|
| 27 |
+
return f"Error converting text to speech: {str(e)}"
|
| 28 |
|
| 29 |
@tool
|
| 30 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
|
| 65 |
|
| 66 |
agent = CodeAgent(
|
| 67 |
model=model,
|
| 68 |
+
tools=[final_answer,get_current_time_in_timezone,visit_webpage,stock_agent,text_to_speech], ## add your tools here (don't remove final answer)
|
| 69 |
max_steps=6,
|
| 70 |
verbosity_level=1,
|
| 71 |
grammar=None,
|