Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -50,7 +50,7 @@ original_feature_names = ['MONTANT', 'FREQUENCE_RECH', 'REVENUE', 'ARPU_SEGMENT'
|
|
| 50 |
st.set_page_config(layout="wide")
|
| 51 |
|
| 52 |
# Main page - Churn Prediction
|
| 53 |
-
st.title('CUSTOMER CHURN PREDICTION APP')
|
| 54 |
|
| 55 |
# Main page - Churn Prediction
|
| 56 |
st.markdown("Churn is a one of the biggest problem in the telecom industry. Research has shown that the average monthly churn rate among the top 4 wireless carriers in the US is 1.9% - 2%")
|
|
@@ -67,7 +67,7 @@ models = {
|
|
| 67 |
}
|
| 68 |
|
| 69 |
# Allow the user to select a model from the sidebar
|
| 70 |
-
model_name = st.sidebar.selectbox('Select Model', list(models.keys()))
|
| 71 |
|
| 72 |
# Retrieve the selected model and its type from the dictionary
|
| 73 |
model = models[model_name]['Logistic Regression']
|
|
@@ -179,7 +179,7 @@ if st.sidebar.button('Predict Churn'):
|
|
| 179 |
if churn_labels[churn_index] == "Churn":
|
| 180 |
churn_prob = churn_probability[churn_index]
|
| 181 |
with col1:
|
| 182 |
-
st.error(f"
|
| 183 |
resized_churn_image = Image.open('Churn.jpeg')
|
| 184 |
resized_churn_image = resized_churn_image.resize((350, 300)) # Adjust the width and height as desired
|
| 185 |
st.image(resized_churn_image)
|
|
@@ -203,7 +203,7 @@ if st.sidebar.button('Predict Churn'):
|
|
| 203 |
else:
|
| 204 |
churn_prob = churn_probability[churn_index]
|
| 205 |
with col1:
|
| 206 |
-
st.success(f"This customer is
|
| 207 |
resized_not_churn_image = Image.open('NotChurn.png')
|
| 208 |
resized_not_churn_image = resized_not_churn_image.resize((350, 300)) # Adjust the width and height as desired
|
| 209 |
st.image(resized_not_churn_image)
|
|
|
|
| 50 |
st.set_page_config(layout="wide")
|
| 51 |
|
| 52 |
# Main page - Churn Prediction
|
| 53 |
+
st.title('CUSTOMER CHURN PREDICTION APP (CCPA)')
|
| 54 |
|
| 55 |
# Main page - Churn Prediction
|
| 56 |
st.markdown("Churn is a one of the biggest problem in the telecom industry. Research has shown that the average monthly churn rate among the top 4 wireless carriers in the US is 1.9% - 2%")
|
|
|
|
| 67 |
}
|
| 68 |
|
| 69 |
# Allow the user to select a model from the sidebar
|
| 70 |
+
#model_name = st.sidebar.selectbox('Select Model', list(models.keys()))
|
| 71 |
|
| 72 |
# Retrieve the selected model and its type from the dictionary
|
| 73 |
model = models[model_name]['Logistic Regression']
|
|
|
|
| 179 |
if churn_labels[churn_index] == "Churn":
|
| 180 |
churn_prob = churn_probability[churn_index]
|
| 181 |
with col1:
|
| 182 |
+
st.error(f"DANGER! This customer is likely to churn with a probability of {churn_prob * 100:.2f}% 😢")
|
| 183 |
resized_churn_image = Image.open('Churn.jpeg')
|
| 184 |
resized_churn_image = resized_churn_image.resize((350, 300)) # Adjust the width and height as desired
|
| 185 |
st.image(resized_churn_image)
|
|
|
|
| 203 |
else:
|
| 204 |
churn_prob = churn_probability[churn_index]
|
| 205 |
with col1:
|
| 206 |
+
st.success(f"This customer is a loyal (not churn) with a probability of {churn_prob * 100:.2f}% 😀")
|
| 207 |
resized_not_churn_image = Image.open('NotChurn.png')
|
| 208 |
resized_not_churn_image = resized_not_churn_image.resize((350, 300)) # Adjust the width and height as desired
|
| 209 |
st.image(resized_not_churn_image)
|