Spaces:
Sleeping
Sleeping
Update app.py
Browse filesFixed variable name mismatch in get_weather tool
app.py
CHANGED
|
@@ -37,9 +37,9 @@ def get_weather(location:str)-> str: #it's import to specify the return type
|
|
| 37 |
# Get current condition values
|
| 38 |
current_conditions= response["current_condition"][0]
|
| 39 |
# Extract weather data
|
| 40 |
-
weather_data=
|
| 41 |
# Extract temperature data
|
| 42 |
-
temperature_data=
|
| 43 |
return f"For {location} location, Weather: {weather_data} Temperature: {temperature_data}"
|
| 44 |
except Exception as e:
|
| 45 |
return f"Error fetching weather data for location '{location}': {str(e)}"
|
|
|
|
| 37 |
# Get current condition values
|
| 38 |
current_conditions= response["current_condition"][0]
|
| 39 |
# Extract weather data
|
| 40 |
+
weather_data= current_conditions["weatherDesc"][0]["value"]
|
| 41 |
# Extract temperature data
|
| 42 |
+
temperature_data= current_conditions["temp_C"], "°C"
|
| 43 |
return f"For {location} location, Weather: {weather_data} Temperature: {temperature_data}"
|
| 44 |
except Exception as e:
|
| 45 |
return f"Error fetching weather data for location '{location}': {str(e)}"
|