Download src/app.py from sevvaliclal/BinaryPredictionwithaRainfallDataset: direct link, hf CLI and curl.
- Browser
- Download file 840 Bytes
-
https://huggingface.co/spaces/sevvaliclal/BinaryPredictionwithaRainfallDataset/resolve/main/src/app.py
- Command line
-
hf download hf://spaces/sevvaliclal/BinaryPredictionwithaRainfallDataset/src/app.py
-
curl -L -o app.py https://huggingface.co/spaces/sevvaliclal/BinaryPredictionwithaRainfallDataset/resolve/main/src/app.py
840 Bytes
| import streamlit as st | |
| import joblib | |
| import pandas as pd | |
| # Load model and features | |
| model = joblib.load("src/final_model.pkl") | |
| features = joblib.load("src/model_features.pkl") | |
| st.set_page_config(page_title="Rainfall Prediction", layout="centered") | |
| st.title("🌧️ Rainfall Prediction App") | |
| st.write("Predict whether it will rain based on meteorological data.") | |
| # Input form | |
| user_input = {} | |
| for feature in features: | |
| user_input[feature] = st.number_input(f"{feature}", value=0.0) | |
| input_df = pd.DataFrame([user_input]) | |
| if st.button("Predict"): | |
| prediction = model.predict(input_df)[0] | |
| probability = model.predict_proba(input_df)[0][1] | |
| if prediction == 1: | |
| st.error(f"🌧️ Rain Expected (Probability: {probability:.2f})") | |
| else: | |
| st.success(f"☀️ No Rain Expected (Probability: {probability:.2f})") |