Spaces:
Sleeping
Sleeping
Update modules/churn_analysis.py
Browse files- modules/churn_analysis.py +0 -66
modules/churn_analysis.py
CHANGED
|
@@ -74,69 +74,3 @@ def predict(SeniorCitizen, Partner, Dependents, tenure,
|
|
| 74 |
|
| 75 |
return prediction_label
|
| 76 |
|
| 77 |
-
input_interface = []
|
| 78 |
-
|
| 79 |
-
with gr.Blocks(theme=gr.themes.Soft()) as churn_interface:
|
| 80 |
-
|
| 81 |
-
Title = gr.Label('Customer Churn Prediction App')
|
| 82 |
-
|
| 83 |
-
with gr.Row():
|
| 84 |
-
Title
|
| 85 |
-
|
| 86 |
-
with gr.Row():
|
| 87 |
-
gr.Markdown("This app predicts likelihood of a customer to leave or stay with the company")
|
| 88 |
-
|
| 89 |
-
with gr.Row():
|
| 90 |
-
with gr.Column():
|
| 91 |
-
input_interface_column_1 = [
|
| 92 |
-
gr.components.Radio(['Yes', 'No'], label="Are you a Seniorcitizen?"),
|
| 93 |
-
gr.components.Radio(['Yes', 'No'], label='Do you have Partner?'),
|
| 94 |
-
gr.components.Radio(['No', 'Yes'], label='Do you have any Dependents?'),
|
| 95 |
-
gr.components.Slider(label='Enter lenghth of Tenure in Months', minimum=1, maximum=73, step=1),
|
| 96 |
-
gr.components.Radio(['DSL', 'Fiber optic', 'No Internet'], label='What is your Internet Service?'),
|
| 97 |
-
gr.components.Radio(['No', 'Yes'], label='Do you have Online Security?'),
|
| 98 |
-
gr.components.Radio(['No', 'Yes'], label='Do you have Online Backup?'),
|
| 99 |
-
gr.components.Radio(['No', 'Yes'], label='Do you have Device Protection?')
|
| 100 |
-
]
|
| 101 |
-
|
| 102 |
-
with gr.Column():
|
| 103 |
-
input_interface_column_2 = [
|
| 104 |
-
gr.components.Radio(['No', 'Yes'], label='Do you have Tech Support?'),
|
| 105 |
-
gr.components.Radio(['No', 'Yes'], label='Do you have Streaming TV?'),
|
| 106 |
-
gr.components.Radio(['No', 'Yes'], label='Do you have Streaming Movies?'),
|
| 107 |
-
gr.components.Radio(['Month-to-month', 'One year', 'Two year'], label='What is your Contract Type?'),
|
| 108 |
-
gr.components.Radio(['Yes', 'No'], label='Do you prefer Paperless Billing?'),
|
| 109 |
-
gr.components.Radio(['Electronic check', 'Mailed check', 'Bank transfer (automatic)', 'Credit card (automatic)'], label='Which PaymentMethod do you prefer?'),
|
| 110 |
-
gr.components.Slider(label="Enter monthly charges", minimum=18.40, maximum=118.65)
|
| 111 |
-
]
|
| 112 |
-
|
| 113 |
-
with gr.Row():
|
| 114 |
-
input_interface.extend(input_interface_column_1)
|
| 115 |
-
input_interface.extend(input_interface_column_2)
|
| 116 |
-
|
| 117 |
-
with gr.Row():
|
| 118 |
-
predict_btn = gr.Button('Predict')
|
| 119 |
-
output_interface = gr.Label(label="churn")
|
| 120 |
-
|
| 121 |
-
with gr.Accordion("Open for information on inputs", open=False):
|
| 122 |
-
gr.Markdown("""This app receives the following as inputs and processes them to return the prediction on whether a customer, will churn or not.
|
| 123 |
-
|
| 124 |
-
- SeniorCitizen: Whether a customer is a senior citizen or not
|
| 125 |
-
- Partner: Whether the customer has a partner or not (Yes, No)
|
| 126 |
-
- Dependents: Whether the customer has dependents or not (Yes, No)
|
| 127 |
-
- Tenure: Number of months the customer has stayed with the company
|
| 128 |
-
- InternetService: Customer's internet service provider (DSL, Fiber Optic, No)
|
| 129 |
-
- OnlineSecurity: Whether the customer has online security or not (Yes, No, No Internet)
|
| 130 |
-
- OnlineBackup: Whether the customer has online backup or not (Yes, No, No Internet)
|
| 131 |
-
- DeviceProtection: Whether the customer has device protection or not (Yes, No, No internet service)
|
| 132 |
-
- TechSupport: Whether the customer has tech support or not (Yes, No, No internet)
|
| 133 |
-
- StreamingTV: Whether the customer has streaming TV or not (Yes, No, No internet service)
|
| 134 |
-
- StreamingMovies: Whether the customer has streaming movies or not (Yes, No, No Internet service)
|
| 135 |
-
- Contract: The contract term of the customer (Month-to-Month, One year, Two year)
|
| 136 |
-
- PaperlessBilling: Whether the customer has paperless billing or not (Yes, No)
|
| 137 |
-
- Payment Method: The customer's payment method (Electronic check, mailed check, Bank transfer(automatic), Credit card(automatic))
|
| 138 |
-
- MonthlyCharges: The amount charged to the customer monthly
|
| 139 |
-
""")
|
| 140 |
-
|
| 141 |
-
predict_btn.click(fn=predict, inputs=input_interface, outputs=output_interface)
|
| 142 |
-
|
|
|
|
| 74 |
|
| 75 |
return prediction_label
|
| 76 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|