arifshora commited on
Commit
d6fa3ed
·
verified ·
1 Parent(s): 37237f7

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +5 -4
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': 1 if Partner=="Yes" else 0,
25
- 'Dependents': 1 if Dependents=="Yes" else 0,
26
- 'PhoneService': 1 if PhoneService=="Yes" else 0,
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, the customer with ID {CustomerID} is likely to {churn_prediction}.")
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