parjun commited on
Commit
ffb9d77
·
verified ·
1 Parent(s): 43b0eb0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -7
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
- def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
15
- #Keep this format for the description / args / args description but feel free to modify the tool
16
- """A tool that does nothing yet
 
17
  Args:
18
- arg1: the first argument
19
- arg2: the second argument
20
  """
21
- return "What magic will you build ?"
 
 
 
 
 
 
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,