File size: 1,653 Bytes
d794134
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import streamlit as st
import joblib

pipe = joblib.load(".model/xgb_pipeline.pkl")

st.set_page_config(page_title="Churn Classification", page_icon="πŸ“Š")
st.title("πŸ“Š Churn Classification")
st.markdown("Enter the details to correctly identify if a person will churn or not.")
st.markdown("> This app is a churn prediction model. This project automates training, evaluation, and deployment of models to Hugging Face using GitHub Actions.")

with st.form("churn_form"):
    BusinessTravel = st.radio("Business Travel Frequency", ["Travel_Rarely", "Travel_Frequently", "Non-Travel"])
    Department = st.radio("Department", ["Research & Development", "Sales", "Human Resources"])
    EducationField = st.radio("Education Field", ["Life Sciences", "Medical", "Marketing", "Technical Degree", "Other"])
    JobLevel = st.slider("Level of Job", 1, 5, step=1)
    JobRole = st.radio("Job Role", [
        "Sales Executive", "Research Scientist", "Laboratory Technician", "Manufacturing Director",
        "Healthcare Representative", "Manager", "Sales Representative", "Research Director", "Human Resources"
    ])
    MaritalStatus = st.radio("Marital Status", ["Married", "Single", "Divorced"])
    OverTime = st.radio("OverTime", ["Yes", "No"])
    StockOptionLevel = st.slider("Stock Option Level", 0, 3, step=1)

    submitted = st.form_submit_button("Predict")

if submitted:
    features = [BusinessTravel, Department, EducationField, JobLevel, JobRole, MaritalStatus, OverTime, StockOptionLevel]
    predicted_churn_result = pipe.predict([features])[0].map({0:"No",1:"Yes"})
    st.success(f"🎯 **Predicted Result**: {predicted_churn_result}")