File size: 711 Bytes
d90c908
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import streamlit as st
import weatherDetect  
st.title("Weather Detection")


city = st.text_input("Enter the city name:")

if st.button("Enter"):
    if city:
        result = weatherDetect.weather(city)  
        if isinstance(result, tuple):
            current_temperature, current_humidity, weather_description = result

            st.write(f"**City:** {city.capitalize()}")
            st.write(f"**Current Temperature:** {current_temperature:.2f}°C")
            st.write(f"**Current Humidity:** {current_humidity}%")
            st.write(f"**Weather Description:** {weather_description.capitalize()}")
        else:
            st.write(result)
    else:
        st.write("Please enter a city name.")