Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,7 +10,8 @@ from Gradio_UI import GradioUI
|
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 11 |
@tool
|
| 12 |
def get_weather(city:str,lat: float, lng:float)-> str:
|
| 13 |
-
"""A tool that returns the weather of a city given its lattitude and longitude
|
|
|
|
| 14 |
Args:
|
| 15 |
city: city name
|
| 16 |
lat: city lattitude
|
|
@@ -42,7 +43,8 @@ def get_weather(city:str,lat: float, lng:float)-> str:
|
|
| 42 |
data = response.json()
|
| 43 |
weather = data["current_weather"]
|
| 44 |
description = weather_descriptions[weather['weathercode']]
|
| 45 |
-
|
|
|
|
| 46 |
else:
|
| 47 |
return "Error fetching weather data."
|
| 48 |
|
|
|
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 11 |
@tool
|
| 12 |
def get_weather(city:str,lat: float, lng:float)-> str:
|
| 13 |
+
"""A tool that returns the weather of a city given its lattitude and longitude. The returned string include readings for
|
| 14 |
+
temperature, wind speed, humidity and weather code e.g., 'clear sky','Partly Cloudy' etc
|
| 15 |
Args:
|
| 16 |
city: city name
|
| 17 |
lat: city lattitude
|
|
|
|
| 43 |
data = response.json()
|
| 44 |
weather = data["current_weather"]
|
| 45 |
description = weather_descriptions[weather['weathercode']]
|
| 46 |
+
windspeed = weather['windspeed']
|
| 47 |
+
return f"The weather in {city} is {weather['temperature']}°C - {description} - {windspeed}."
|
| 48 |
else:
|
| 49 |
return "Error fetching weather data."
|
| 50 |
|