Download src/app.py from sevvaliclal/BinaryClassificationwithaBankChurnDataset: direct link, hf CLI and curl.
- Browser
- Download file 777 Bytes
-
https://huggingface.co/spaces/sevvaliclal/BinaryClassificationwithaBankChurnDataset/resolve/main/src/app.py
- Command line
-
hf download hf://spaces/sevvaliclal/BinaryClassificationwithaBankChurnDataset/src/app.py
-
curl -L -o app.py https://huggingface.co/spaces/sevvaliclal/BinaryClassificationwithaBankChurnDataset/resolve/main/src/app.py
777 Bytes
| import streamlit as st | |
| import pandas as pd | |
| import joblib | |
| # Load model & features | |
| model = joblib.load("src/final_model.pkl") | |
| features = joblib.load("src/model_features.pkl") | |
| st.set_page_config(page_title="Churn Prediction", layout="centered") | |
| st.title("🔍 Customer Churn Prediction") | |
| st.write("Enter customer information to predict churn probability.") | |
| # User input | |
| input_data = {} | |
| for feature in features: | |
| input_data[feature] = st.number_input(feature, value=0.0) | |
| input_df = pd.DataFrame([input_data]) | |
| if st.button("Predict"): | |
| proba = model.predict_proba(input_df)[0][1] | |
| st.metric("Churn Probability", f"{proba:.2%}") | |
| if proba > 0.5: | |
| st.error("⚠️ Customer is likely to churn") | |
| else: | |
| st.success("✅ Customer is likely to stay") |