Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -16,7 +16,6 @@ def get_weather(city_name):
|
|
| 16 |
temp = data['main']['temp']
|
| 17 |
humidity = data['main']['humidity']
|
| 18 |
|
| 19 |
-
# Adding emojis and creative text
|
| 20 |
weather_emoji = "☀️" if "clear" in weather else "☁️" if "cloud" in weather else "🌧️" if "rain" in weather else "❄️" if "snow" in weather else "🌫️"
|
| 21 |
return (f"In {city_name}, the weather is currently {weather} {weather_emoji}. "
|
| 22 |
f"The temperature is a comfy {temp}°C 🌡️. "
|
|
@@ -24,7 +23,7 @@ def get_weather(city_name):
|
|
| 24 |
else:
|
| 25 |
return "Failed to retrieve data. Please check the city name and try again."
|
| 26 |
|
| 27 |
-
#
|
| 28 |
iface = gr.Interface(
|
| 29 |
fn=get_weather,
|
| 30 |
inputs=gr.Textbox(label="Enter City Name", placeholder="Type here..."),
|
|
@@ -33,5 +32,5 @@ iface = gr.Interface(
|
|
| 33 |
description="Enter a city name to get a lively description of the current weather, temperature, and humidity."
|
| 34 |
)
|
| 35 |
|
| 36 |
-
#
|
| 37 |
iface.launch()
|
|
|
|
| 16 |
temp = data['main']['temp']
|
| 17 |
humidity = data['main']['humidity']
|
| 18 |
|
|
|
|
| 19 |
weather_emoji = "☀️" if "clear" in weather else "☁️" if "cloud" in weather else "🌧️" if "rain" in weather else "❄️" if "snow" in weather else "🌫️"
|
| 20 |
return (f"In {city_name}, the weather is currently {weather} {weather_emoji}. "
|
| 21 |
f"The temperature is a comfy {temp}°C 🌡️. "
|
|
|
|
| 23 |
else:
|
| 24 |
return "Failed to retrieve data. Please check the city name and try again."
|
| 25 |
|
| 26 |
+
# Defining Gradio interface
|
| 27 |
iface = gr.Interface(
|
| 28 |
fn=get_weather,
|
| 29 |
inputs=gr.Textbox(label="Enter City Name", placeholder="Type here..."),
|
|
|
|
| 32 |
description="Enter a city name to get a lively description of the current weather, temperature, and humidity."
|
| 33 |
)
|
| 34 |
|
| 35 |
+
# Launching the interface
|
| 36 |
iface.launch()
|