Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -14,6 +14,7 @@ st.title("Customer Churn Prediction App")
|
|
| 14 |
st.write("This tool predicts customer churn risk based on their details. Enter the required information below.")
|
| 15 |
|
| 16 |
# Collect user input based on dataset columns
|
|
|
|
| 17 |
Partner = st.selectbox("Does the customer have a partner?", ["Yes", "No"])
|
| 18 |
Dependents = st.selectbox("Does the customer have dependents?", ["Yes", "No"])
|
| 19 |
PhoneService = st.selectbox("Does the customer have phone service?", ["Yes", "No"])
|
|
@@ -26,13 +27,14 @@ TotalCharges = st.number_input("Total Charges", min_value=0.0, value=600.0)
|
|
| 26 |
|
| 27 |
# Convert categorical inputs to match model training
|
| 28 |
input_data = pd.DataFrame([{
|
|
|
|
| 29 |
'Partner': 1 if Partner == "Yes" else 0,
|
| 30 |
'Dependents': 1 if Dependents == "Yes" else 0,
|
| 31 |
'PhoneService': 1 if PhoneService == "Yes" else 0,
|
| 32 |
'InternetService': InternetService,
|
| 33 |
'Contract': Contract,
|
| 34 |
'PaymentMethod': PaymentMethod,
|
| 35 |
-
'
|
| 36 |
'MonthlyCharges': MonthlyCharges,
|
| 37 |
'TotalCharges': TotalCharges
|
| 38 |
}])
|
|
|
|
| 14 |
st.write("This tool predicts customer churn risk based on their details. Enter the required information below.")
|
| 15 |
|
| 16 |
# Collect user input based on dataset columns
|
| 17 |
+
SeniorCitizen = st.selectbox("Is the customer a SeniorCitizen?", ["Yes", "No"])
|
| 18 |
Partner = st.selectbox("Does the customer have a partner?", ["Yes", "No"])
|
| 19 |
Dependents = st.selectbox("Does the customer have dependents?", ["Yes", "No"])
|
| 20 |
PhoneService = st.selectbox("Does the customer have phone service?", ["Yes", "No"])
|
|
|
|
| 27 |
|
| 28 |
# Convert categorical inputs to match model training
|
| 29 |
input_data = pd.DataFrame([{
|
| 30 |
+
'SeniorCitizen': 1 if SeniorCitizen == "Yes" else 0,
|
| 31 |
'Partner': 1 if Partner == "Yes" else 0,
|
| 32 |
'Dependents': 1 if Dependents == "Yes" else 0,
|
| 33 |
'PhoneService': 1 if PhoneService == "Yes" else 0,
|
| 34 |
'InternetService': InternetService,
|
| 35 |
'Contract': Contract,
|
| 36 |
'PaymentMethod': PaymentMethod,
|
| 37 |
+
'tenure': Tenure,
|
| 38 |
'MonthlyCharges': MonthlyCharges,
|
| 39 |
'TotalCharges': TotalCharges
|
| 40 |
}])
|