Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,4 @@
|
|
| 1 |
-
from smolagents import CodeAgent, DuckDuckGoSearchTool,
|
| 2 |
-
HfApiModel, load_tool, tool
|
| 3 |
import datetime
|
| 4 |
import requests
|
| 5 |
import pytz
|
|
@@ -29,7 +28,8 @@ def get_weather(city: str, country_code: str = "US") -> str:
|
|
| 29 |
data = response.json()
|
| 30 |
|
| 31 |
if response.status_code != 200:
|
| 32 |
-
return f"Failed to fetch weather: {data
|
|
|
|
| 33 |
|
| 34 |
weather_description = data["weather"][0]["description"]
|
| 35 |
temperature = data["main"]["temp"]
|
|
|
|
| 1 |
+
from smolagents import ( CodeAgent, DuckDuckGoSearchTool, HfApiModel, load_tool, tool )
|
|
|
|
| 2 |
import datetime
|
| 3 |
import requests
|
| 4 |
import pytz
|
|
|
|
| 28 |
data = response.json()
|
| 29 |
|
| 30 |
if response.status_code != 200:
|
| 31 |
+
return f"Failed to fetch weather: {data
|
| 32 |
+
.get('message', 'Unknown error')}"
|
| 33 |
|
| 34 |
weather_description = data["weather"][0]["description"]
|
| 35 |
temperature = data["main"]["temp"]
|