MrUtakata commited on
Commit
6d6aea6
·
verified ·
1 Parent(s): c6206b4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -30,9 +30,11 @@ age = st.number_input("Age", min_value=18, max_value=100, value=30)
30
  tenure = st.number_input("Tenure (in months)", min_value=0, max_value=120, value=12)
31
  usage_frequency = st.number_input("Usage Frequency", min_value=0, max_value=100, value=5)
32
  support_calls = st.number_input("Support Calls", min_value=0, max_value=50, value=2)
 
33
  total_spend = st.number_input("Total Spend", min_value=0.0, max_value=10000.0, value=100.0, step=10.0)
 
34
 
35
- # ✅ Updated: Match categories used during training
36
  gender = st.selectbox("Gender", options=["Male", "Female"])
37
  subscription_type = st.selectbox("Subscription Type", options=["Premium", "Standard"])
38
  contract_length = st.selectbox("Contract Length", options=["Monthly", "Quarterly"])
@@ -43,7 +45,9 @@ input_df = pd.DataFrame({
43
  "Tenure": [tenure],
44
  "Usage Frequency": [usage_frequency],
45
  "Support Calls": [support_calls],
 
46
  "Total Spend": [total_spend],
 
47
  "Gender": [gender],
48
  "Subscription Type": [subscription_type],
49
  "Contract Length": [contract_length]
@@ -65,7 +69,7 @@ input_scaled = scaler.transform(input_transformed)
65
  if st.button("Predict Churn"):
66
  prediction = ensemble.predict(input_scaled)
67
  prediction_proba = ensemble.predict_proba(input_scaled)[:, 1]
68
-
69
  result = "Churned" if prediction[0] == 1 else "Not Churned"
70
  st.write("### Prediction Results")
71
  st.write(f"**Prediction:** {result}")
 
30
  tenure = st.number_input("Tenure (in months)", min_value=0, max_value=120, value=12)
31
  usage_frequency = st.number_input("Usage Frequency", min_value=0, max_value=100, value=5)
32
  support_calls = st.number_input("Support Calls", min_value=0, max_value=50, value=2)
33
+ payment_delay = st.number_input("Payment Delay (days)", min_value=0, max_value=365, value=5)
34
  total_spend = st.number_input("Total Spend", min_value=0.0, max_value=10000.0, value=100.0, step=10.0)
35
+ last_interaction = st.number_input("Last Interaction (days ago)", min_value=0, max_value=365, value=15)
36
 
37
+ # Match categories used during training
38
  gender = st.selectbox("Gender", options=["Male", "Female"])
39
  subscription_type = st.selectbox("Subscription Type", options=["Premium", "Standard"])
40
  contract_length = st.selectbox("Contract Length", options=["Monthly", "Quarterly"])
 
45
  "Tenure": [tenure],
46
  "Usage Frequency": [usage_frequency],
47
  "Support Calls": [support_calls],
48
+ "Payment Delay": [payment_delay],
49
  "Total Spend": [total_spend],
50
+ "Last Interaction": [last_interaction],
51
  "Gender": [gender],
52
  "Subscription Type": [subscription_type],
53
  "Contract Length": [contract_length]
 
69
  if st.button("Predict Churn"):
70
  prediction = ensemble.predict(input_scaled)
71
  prediction_proba = ensemble.predict_proba(input_scaled)[:, 1]
72
+
73
  result = "Churned" if prediction[0] == 1 else "Not Churned"
74
  st.write("### Prediction Results")
75
  st.write(f"**Prediction:** {result}")