Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -35,7 +35,7 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
| 35 |
|
| 36 |
@tool
|
| 37 |
def get_weather_forecast(city_name: str) -> str:
|
| 38 |
-
"""A tool that fetches the current weather of a specified city.
|
| 39 |
Args:
|
| 40 |
city_name: A string representing a valid city (e.g., 'Bangalore').
|
| 41 |
"""
|
|
@@ -102,22 +102,20 @@ def get_coordinates_no_api_key(city_name: str) -> [float, float]:
|
|
| 102 |
print(f"Error parsing geocoding response: {e}")
|
| 103 |
return None, None
|
| 104 |
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
except Exception as e:
|
| 120 |
-
return f"Error fetching weather conditions for {city}"
|
| 121 |
|
| 122 |
final_answer = FinalAnswerTool()
|
| 123 |
|
|
|
|
| 35 |
|
| 36 |
@tool
|
| 37 |
def get_weather_forecast(city_name: str) -> str:
|
| 38 |
+
"""A tool that fetches the current weather/temperature of a specified city.
|
| 39 |
Args:
|
| 40 |
city_name: A string representing a valid city (e.g., 'Bangalore').
|
| 41 |
"""
|
|
|
|
| 102 |
print(f"Error parsing geocoding response: {e}")
|
| 103 |
return None, None
|
| 104 |
|
| 105 |
+
# def get_weather(city: str) -> str:
|
| 106 |
+
# """A tool that fetches the current weather of a specified city.
|
| 107 |
+
# Args:
|
| 108 |
+
# city: A string representing a valid city (e.g., 'Bangalore').
|
| 109 |
+
# """
|
| 110 |
+
# try:
|
| 111 |
+
# response = requests.get('https://api.open-meteo.com/v1/forecast?latitude=52.52&longitude=13.41&hourly=temperature_2m&models=bom_access_global')
|
| 112 |
+
# weatherJSON = response.json()
|
| 113 |
+
# cityName = weatherJSON.get('location').get('name')
|
| 114 |
+
# cityTemp = weatherJSON.get('current').get('temp_c')
|
| 115 |
+
# cityCondition = weatherJSON.get('current').get('condition').get('text')
|
| 116 |
+
# return f"The current Temperature in {cityName} is {cityTemp} and conditions are {cityCondition}"
|
| 117 |
+
# except Exception as e:
|
| 118 |
+
# return f"Error fetching weather conditions for {city}"
|
|
|
|
|
|
|
| 119 |
|
| 120 |
final_answer = FinalAnswerTool()
|
| 121 |
|