Spaces:
Running
Running
Fix 'get_weather' function
Browse files
app.py
CHANGED
@@ -8,27 +8,14 @@ import os
|
|
8 |
|
9 |
from Gradio_UI import GradioUI
|
10 |
|
11 |
-
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
12 |
-
@tool
|
13 |
-
def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
|
14 |
-
#Keep this format for the description / args / args description but feel free to modify the tool
|
15 |
-
"""A tool that does nothing yet
|
16 |
-
Args:
|
17 |
-
arg1: the first argument
|
18 |
-
arg2: the second argument
|
19 |
-
"""
|
20 |
-
return "What magic will you build ?"
|
21 |
-
|
22 |
@tool
|
23 |
def get_weather(city: str) -> str:
|
24 |
"""
|
25 |
-
A tool that fetches the current weather for
|
26 |
Args:
|
27 |
-
city (str): Name of the city.
|
28 |
-
Returns:
|
29 |
-
str: Weather description or error message.
|
30 |
"""
|
31 |
-
api_key = "
|
32 |
base_url = "https://api.openweathermap.org/data/2.5/weather"
|
33 |
params = {"q": city, "appid": api_key, "units": "metric", "lang": "en"}
|
34 |
|
|
|
8 |
|
9 |
from Gradio_UI import GradioUI
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
@tool
|
12 |
def get_weather(city: str) -> str:
|
13 |
"""
|
14 |
+
A tool that fetches the current weather for the specified city.
|
15 |
Args:
|
16 |
+
city (str): Name of the city (e.g. 'Athens', 'New York' etc.)
|
|
|
|
|
17 |
"""
|
18 |
+
api_key = os.getenv("OPEN_WEATHER_API")
|
19 |
base_url = "https://api.openweathermap.org/data/2.5/weather"
|
20 |
params = {"q": city, "appid": api_key, "units": "metric", "lang": "en"}
|
21 |
|