File size: 1,542 Bytes
ab0f28a
6d2171f
dcb0a5b
ab0f28a
dcb0a5b
ab0f28a
 
 
dcb0a5b
ab0f28a
9a8abb4
dcb0a5b
ab0f28a
ea328fc
 
4b79f33
9b4a7b5
1b290df
ea328fc
 
13bb4c4
 
ab0f28a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4fad8c0
ab0f28a
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41

import streamlit as st
import pandas as pd
import pickle

# Load the saved model
with open('weather_classifier_model.pkl', 'rb') as file:
    loaded_model = pickle.load(file)

# Streamlit app
st.title(":red[🌦️ Weather Prediction App]")

# Input features
temperature = st.number_input("Temperature (°C)", min_value=-50.0, max_value=50.0, step=0.1)
humidity = st.number_input("Humidity (%)", min_value=0.0, max_value=100.0, step=0.1)
wind_speed = st.number_input("Wind Speed (km/h)",min_value=0, max_value=150, value=10)
cloud_cover =  st.selectbox("Cloud Cover", ['partly cloudy', 'clear', 'overcast', 'cloudy'])
precipitation = st.number_input("Precipitation (%)",min_value=0, max_value=100, value=10)
uv_index = st.number_input("UV Index", min_value=0, max_value=15, value=5)
visibility = st.number_input("Visibility (km)",min_value=0, max_value=50, value=10)
season = st.selectbox("Season", ['Winter', 'Spring', 'Summer', 'Autumn'])  # Updated season options
location = st.selectbox("Location", ["inland", "mountain", "coastal"])


# Create input DataFrame
input_data = pd.DataFrame({
    "Temperature": [temperature],
    "Humidity": [humidity],
    "Wind Speed": [wind_speed],
    "Cloud Cover": [cloud_cover],
    "Precipitation (%)": [precipitation],
    "UV Index": [uv_index],
    "Visibility (km)": [visibility],
    "Season": [season],
    "Location": [location]
})

# Make prediction
if st.button(":blue[Predict]"):
    prediction = loaded_model.predict(input_data)[0]
    st.success(f"Predicted Weather Type: {prediction}")