Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -14,7 +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 |
-
SeniorCitizen = st.selectbox("Is the customer a senior citizen?",[
|
| 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,10 +27,10 @@ TotalCharges = st.number_input("Total Charges", min_value=0.0, value=600.0)
|
|
| 27 |
|
| 28 |
# Convert categorical inputs to match model training
|
| 29 |
input_data = pd.DataFrame([{
|
| 30 |
-
'SeniorCitizen'
|
| 31 |
-
'Partner':
|
| 32 |
-
'Dependents':
|
| 33 |
-
'PhoneService':
|
| 34 |
'InternetService': InternetService,
|
| 35 |
'Contract': Contract,
|
| 36 |
'PaymentMethod': PaymentMethod,
|
|
|
|
| 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 senior citizen?",["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': Partner,
|
| 32 |
+
'Dependents': Dependents,
|
| 33 |
+
'PhoneService': PhoneService,
|
| 34 |
'InternetService': InternetService,
|
| 35 |
'Contract': Contract,
|
| 36 |
'PaymentMethod': PaymentMethod,
|