Spaces:
Build error
Build error
Add application file
Browse files
app.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import weatherDetect
|
| 3 |
+
st.title("Weather Detection")
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
city = st.text_input("Enter the city name:")
|
| 7 |
+
|
| 8 |
+
if st.button("Enter"):
|
| 9 |
+
if city:
|
| 10 |
+
result = weatherDetect.weather(city)
|
| 11 |
+
if isinstance(result, tuple):
|
| 12 |
+
current_temperature, current_humidity, weather_description = result
|
| 13 |
+
|
| 14 |
+
st.write(f"**City:** {city.capitalize()}")
|
| 15 |
+
st.write(f"**Current Temperature:** {current_temperature:.2f}°C")
|
| 16 |
+
st.write(f"**Current Humidity:** {current_humidity}%")
|
| 17 |
+
st.write(f"**Weather Description:** {weather_description.capitalize()}")
|
| 18 |
+
else:
|
| 19 |
+
st.write(result)
|
| 20 |
+
else:
|
| 21 |
+
st.write("Please enter a city name.")
|