knt21 commited on
Commit
e0da6bd
·
verified ·
1 Parent(s): 53197ae

Update app.py

Browse files

Fixed variable name mismatch in get_weather tool

Files changed (1) hide show
  1. app.py +2 -2
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= current["weatherDesc"][0]["value"]
41
  # Extract temperature data
42
- temperature_data= current["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)}"
 
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)}"