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}")