Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 my_custom_tool(
|
| 13 |
#Keep this format for the description / args / args description but feel free to modify the tool
|
| 14 |
"""A tool that fetches the weather for a provided city and state. This tool only works for the united states
|
| 15 |
Args:
|
| 16 |
-
|
| 17 |
-
state: name of the state in the united states
|
| 18 |
"""
|
| 19 |
api_key = "3MfEYSjmLMlWRZCbw7VSLhaGyptxpUYP"
|
| 20 |
country = "United States"
|
| 21 |
|
| 22 |
-
url_city = f"http://dataservice.accuweather.com/locations/v1/cities/
|
| 23 |
params = {
|
| 24 |
"apikey": api_key,
|
| 25 |
-
"q":
|
| 26 |
}
|
| 27 |
|
| 28 |
response = requests.get(url_city, params=params)
|
|
|
|
| 9 |
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 11 |
@tool
|
| 12 |
+
def my_custom_tool(location_name: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 fetches the weather for a provided city and state. This tool only works for the united states
|
| 15 |
Args:
|
| 16 |
+
location_name: name of city, state to find weather in the United States
|
|
|
|
| 17 |
"""
|
| 18 |
api_key = "3MfEYSjmLMlWRZCbw7VSLhaGyptxpUYP"
|
| 19 |
country = "United States"
|
| 20 |
|
| 21 |
+
url_city = f"http://dataservice.accuweather.com/locations/v1/cities/search"
|
| 22 |
params = {
|
| 23 |
"apikey": api_key,
|
| 24 |
+
"q": location_name,
|
| 25 |
}
|
| 26 |
|
| 27 |
response = requests.get(url_city, params=params)
|