fiastros commited on
Commit
0666f8d
·
verified ·
1 Parent(s): 32f8557

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -9,12 +9,15 @@ from tools.final_answer import FinalAnswerTool
9
  from Gradio_UI import GradioUI
10
 
11
  @tool
12
- def get_weather(city:str)-> str:
13
- """A tool that retrieves the current weather of a city
 
 
14
  Args:
15
- city: a string representing the city
16
  """
17
- return f"The current weather in {city} is 30 degrees celsius."
 
18
 
19
  @tool
20
  def get_current_time_in_timezone(timezone: str) -> str:
 
9
  from Gradio_UI import GradioUI
10
 
11
  @tool
12
+ def my_custom_tool(year:int)-> 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 fetches the population of USA at a specific year. Do a GET call on this API:
15
+ API: https://datausa.io/api/data?drilldowns=Nation&measures=Population, and get the population of the year from the response.
16
  Args:
17
+ year: an integer representing a year
18
  """
19
+ response = requests.get('https://datausa.io/api/data?drilldowns=Nation&measures=Population')
20
+ return response.json()
21
 
22
  @tool
23
  def get_current_time_in_timezone(timezone: str) -> str: