Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -55,24 +55,26 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
55 |
|
56 |
except Exception as e:
|
57 |
return f"⚠️ Error fetching time for timezone '{timezone}': {str(e)}"
|
58 |
-
|
59 |
-
|
60 |
@tool
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
|
|
|
|
|
|
|
|
76 |
|
77 |
@tool
|
78 |
def getMarsWeather() -> str:
|
|
|
55 |
|
56 |
except Exception as e:
|
57 |
return f"⚠️ Error fetching time for timezone '{timezone}': {str(e)}"
|
|
|
|
|
58 |
@tool
|
59 |
+
def get_weather(location: str, zipcode: int) -> str:
|
60 |
+
"""Fetches the current weather for a specified location or a zip code.
|
61 |
+
|
62 |
+
Args:
|
63 |
+
location: A string representing a valid city name or region (e.g., 'New York').
|
64 |
+
zipcode: An integer representing a valid zip code (e.g., 10001 for NYC).
|
65 |
+
|
66 |
+
Returns:
|
67 |
+
A string describing the weather conditions, temperature, and humidity.
|
68 |
+
"""
|
69 |
+
|
70 |
+
temperature = data["main"]["temp"]
|
71 |
+
conditions = data["weather"][0]["description"]
|
72 |
+
humidity = data["main"]["humidity"]
|
73 |
+
|
74 |
+
return (f"🌤️ Weather in {location} is: {conditions.capitalize()}, "
|
75 |
+
f"Temperature: {temperature}°C, Humidity: {humidity}%")
|
76 |
+
|
77 |
+
#return f"The current weather in {location,zipcode} is: {temperature,}"
|
78 |
|
79 |
@tool
|
80 |
def getMarsWeather() -> str:
|