Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -21,9 +21,9 @@ SeniorCitizen = st.selectbox("Is the customer a senior citizen?", ["Yes", "No"])
|
|
| 21 |
|
| 22 |
# Convert categorical inputs to match model training
|
| 23 |
customer_data = {
|
| 24 |
-
'Partner':
|
| 25 |
-
'Dependents':
|
| 26 |
-
'PhoneService':
|
| 27 |
'InternetService': InternetService,
|
| 28 |
'Contract': Contract,
|
| 29 |
'PaymentMethod': PaymentMethod,
|
|
@@ -31,6 +31,7 @@ customer_data = {
|
|
| 31 |
'MonthlyCharges': MonthlyCharges,
|
| 32 |
'TotalCharges': TotalCharges,
|
| 33 |
'SeniorCitizen':1 if SeniorCitizen == "Yes" else 0
|
|
|
|
| 34 |
}
|
| 35 |
|
| 36 |
if st.button("Predict", type='primary'):
|
|
@@ -38,7 +39,7 @@ if st.button("Predict", type='primary'):
|
|
| 38 |
if response.status_code == 200:
|
| 39 |
result = response.json()
|
| 40 |
churn_prediction = result["Prediction"] # Extract only the value
|
| 41 |
-
st.write(f"Based on the information provided
|
| 42 |
else:
|
| 43 |
st.error("Error in API request")
|
| 44 |
|
|
|
|
| 21 |
|
| 22 |
# Convert categorical inputs to match model training
|
| 23 |
customer_data = {
|
| 24 |
+
'Partner': Partner,
|
| 25 |
+
'Dependents': Dependents,
|
| 26 |
+
'PhoneService': PhoneService,
|
| 27 |
'InternetService': InternetService,
|
| 28 |
'Contract': Contract,
|
| 29 |
'PaymentMethod': PaymentMethod,
|
|
|
|
| 31 |
'MonthlyCharges': MonthlyCharges,
|
| 32 |
'TotalCharges': TotalCharges,
|
| 33 |
'SeniorCitizen':1 if SeniorCitizen == "Yes" else 0
|
| 34 |
+
|
| 35 |
}
|
| 36 |
|
| 37 |
if st.button("Predict", type='primary'):
|
|
|
|
| 39 |
if response.status_code == 200:
|
| 40 |
result = response.json()
|
| 41 |
churn_prediction = result["Prediction"] # Extract only the value
|
| 42 |
+
st.write(f"Based on the information provided is likely to {churn_prediction}.")
|
| 43 |
else:
|
| 44 |
st.error("Error in API request")
|
| 45 |
|