Spaces:
Sleeping
Sleeping
Update app_gradio.py
Browse files- app_gradio.py +5 -1
app_gradio.py
CHANGED
@@ -32,8 +32,12 @@ def churn_prediction(age, gender, tenure, usage_frequency, support_calls, paymen
|
|
32 |
prediction = best_model.predict(input_df)
|
33 |
prediction_proba = best_model.predict_proba(input_df)[:, 1]
|
34 |
|
35 |
-
churn_result = "Yes" if prediction[0] == 1 else "No"
|
36 |
churn_probability = f"{prediction_proba[0]:.2f}"
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
return churn_result, churn_probability, roc_img
|
39 |
except Exception as e:
|
|
|
32 |
prediction = best_model.predict(input_df)
|
33 |
prediction_proba = best_model.predict_proba(input_df)[:, 1]
|
34 |
|
|
|
35 |
churn_probability = f"{prediction_proba[0]:.2f}"
|
36 |
+
if prediction_proba[0] < 0.65:
|
37 |
+
churn_result = "No"
|
38 |
+
else:
|
39 |
+
churn_result = "Yes" if prediction[0] == 1 else "No"
|
40 |
+
|
41 |
|
42 |
return churn_result, churn_probability, roc_img
|
43 |
except Exception as e:
|