Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -33,6 +33,24 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
33 |
except Exception as e:
|
34 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
final_answer = FinalAnswerTool()
|
38 |
|
|
|
33 |
except Exception as e:
|
34 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
35 |
|
36 |
+
@tool
|
37 |
+
def get_weather_api(city : str) ->:
|
38 |
+
"""A tool that get the current weather.
|
39 |
+
Args:
|
40 |
+
city: A string that repesents a city name
|
41 |
+
"""
|
42 |
+
api_key = ff33163dc424d6430b66535cb02dda7d
|
43 |
+
|
44 |
+
response = http://api.weatherstack.com/current
|
45 |
+
? access_key = ff33163dc424d6430b66535cb02dda7d
|
46 |
+
& query = city
|
47 |
+
data = response.json()
|
48 |
+
|
49 |
+
temp = data['current']['weather_descriptions']
|
50 |
+
retrun f"the current weather in {city} is {temp}"
|
51 |
+
|
52 |
+
|
53 |
+
|
54 |
|
55 |
final_answer = FinalAnswerTool()
|
56 |
|