jayur commited on
Commit
717444a
·
verified ·
1 Parent(s): fb62c19

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -8
app.py CHANGED
@@ -9,20 +9,19 @@ 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 country_stats(country:str, indicator:str)->str: #it's import to specify the return type
13
  #Keep this format for the description / args / args description but feel free to modify the tool
14
- """A tool that retrieves the value of the indicator for the country
15
  Args:
16
- country: Name of the country e.g. United States, India, China
17
- indicator: the value of the statistic requested as a string e.g Population, GDP, Land area
18
  """
19
  try:
20
  # Create DuckDuckGo web search object
21
  search = DuckDuckGoSearchRun()
22
- indicator_val = search.invoke(f"What is the {indicator} of {country}")
23
- return f"The {indicator} of {country} is : {indicator_val}"
24
  except Exception as e:
25
- return f"Error: Search failed for {indicator} of {country}"
26
 
27
  @tool
28
  def get_current_time_in_timezone(timezone: str) -> str:
@@ -61,7 +60,7 @@ with open("prompts.yaml", 'r') as stream:
61
 
62
  agent = CodeAgent(
63
  model=model,
64
- tools=[final_answer, country_stats, get_current_time_in_timezone], ## add your tools here (don't remove final answer)
65
  max_steps=6,
66
  verbosity_level=1,
67
  grammar=None,
 
9
 
10
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
11
  @tool
12
+ def lingua_stats(language:str)->str: #it's import to specify the return type
13
  #Keep this format for the description / args / args description but feel free to modify the tool
14
+ """A tool that retrieves the number of speakers for the language
15
  Args:
16
+ language: Name of the language e.g. Tamil, Hindi, English
 
17
  """
18
  try:
19
  # Create DuckDuckGo web search object
20
  search = DuckDuckGoSearchRun()
21
+ lang_spkrs = search.invoke(f"How many people speak {language}")
22
+ return f"The {language} speaking population is : {lang_spkrs}"
23
  except Exception as e:
24
+ return f"Error: Search failed for {language}"
25
 
26
  @tool
27
  def get_current_time_in_timezone(timezone: str) -> str:
 
60
 
61
  agent = CodeAgent(
62
  model=model,
63
+ tools=[final_answer, lingua_stats_stats, get_current_time_in_timezone], ## add your tools here (don't remove final answer)
64
  max_steps=6,
65
  verbosity_level=1,
66
  grammar=None,