IS361Group4 commited on
Commit
f362d95
·
verified ·
1 Parent(s): 886f866

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +55 -55
app.py CHANGED
@@ -16,63 +16,63 @@ with gr.Blocks() as app:
16
  with gr.Tab("Churn Analysis"):
17
  gr.Markdown("Customer Churn Prediction")
18
 
19
- # Define your inputs for churn prediction
20
- with gr.Row():
21
- gr.Markdown("This app predicts likelihood of a customer to leave or stay with the company")
22
-
23
- with gr.Row():
24
- with gr.Column():
25
- input_interface_column_1 = [
26
- gr.components.Radio(['Yes', 'No'], label="Are you a Seniorcitizen?"),
27
- gr.components.Radio(['Yes', 'No'], label='Do you have Partner?'),
28
- gr.components.Radio(['No', 'Yes'], label='Do you have any Dependents?'),
29
- gr.components.Slider(label='Enter lenghth of Tenure in Months', minimum=1, maximum=73, step=1),
30
- gr.components.Radio(['DSL', 'Fiber optic', 'No Internet'], label='What is your Internet Service?'),
31
- gr.components.Radio(['No', 'Yes'], label='Do you have Online Security?'),
32
- gr.components.Radio(['No', 'Yes'], label='Do you have Online Backup?'),
33
- gr.components.Radio(['No', 'Yes'], label='Do you have Device Protection?')
34
- ]
35
-
36
- with gr.Column():
37
- input_interface_column_2 = [
38
- gr.components.Radio(['No', 'Yes'], label='Do you have Tech Support?'),
39
- gr.components.Radio(['No', 'Yes'], label='Do you have Streaming TV?'),
40
- gr.components.Radio(['No', 'Yes'], label='Do you have Streaming Movies?'),
41
- gr.components.Radio(['Month-to-month', 'One year', 'Two year'], label='What is your Contract Type?'),
42
- gr.components.Radio(['Yes', 'No'], label='Do you prefer Paperless Billing?'),
43
- gr.components.Radio(['Electronic check', 'Mailed check', 'Bank transfer (automatic)', 'Credit card (automatic)'], label='Which PaymentMethod do you prefer?'),
44
- gr.components.Slider(label="Enter monthly charges", minimum=18.40, maximum=118.65)
45
- ]
46
-
47
- with gr.Row():
48
- input_interface.extend(input_interface_column_1)
49
- input_interface.extend(input_interface_column_2)
50
-
51
- with gr.Row():
52
- predict_btn = gr.Button('Predict')
53
- output_interface = gr.Label(label="churn")
54
 
55
- with gr.Accordion("Open for information on inputs", open=False):
56
- gr.Markdown("""This app receives the following as inputs and processes them to return the prediction on whether a customer, will churn or not.
57
-
58
- - SeniorCitizen: Whether a customer is a senior citizen or not
59
- - Partner: Whether the customer has a partner or not (Yes, No)
60
- - Dependents: Whether the customer has dependents or not (Yes, No)
61
- - Tenure: Number of months the customer has stayed with the company
62
- - InternetService: Customer's internet service provider (DSL, Fiber Optic, No)
63
- - OnlineSecurity: Whether the customer has online security or not (Yes, No, No Internet)
64
- - OnlineBackup: Whether the customer has online backup or not (Yes, No, No Internet)
65
- - DeviceProtection: Whether the customer has device protection or not (Yes, No, No internet service)
66
- - TechSupport: Whether the customer has tech support or not (Yes, No, No internet)
67
- - StreamingTV: Whether the customer has streaming TV or not (Yes, No, No internet service)
68
- - StreamingMovies: Whether the customer has streaming movies or not (Yes, No, No Internet service)
69
- - Contract: The contract term of the customer (Month-to-Month, One year, Two year)
70
- - PaperlessBilling: Whether the customer has paperless billing or not (Yes, No)
71
- - Payment Method: The customer's payment method (Electronic check, mailed check, Bank transfer(automatic), Credit card(automatic))
72
- - MonthlyCharges: The amount charged to the customer monthly
73
- """)
74
 
75
- predict_btn.click(fn=predict, inputs=input_interface, outputs=output_interface)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
 
77
 
78
 
 
16
  with gr.Tab("Churn Analysis"):
17
  gr.Markdown("Customer Churn Prediction")
18
 
19
+ # Define your inputs for churn prediction
20
+ with gr.Row():
21
+ gr.Markdown("This app predicts likelihood of a customer to leave or stay with the company")
22
+
23
+ with gr.Row():
24
+ with gr.Column():
25
+ input_interface_column_1 = [
26
+ gr.components.Radio(['Yes', 'No'], label="Are you a Seniorcitizen?"),
27
+ gr.components.Radio(['Yes', 'No'], label='Do you have Partner?'),
28
+ gr.components.Radio(['No', 'Yes'], label='Do you have any Dependents?'),
29
+ gr.components.Slider(label='Enter lenghth of Tenure in Months', minimum=1, maximum=73, step=1),
30
+ gr.components.Radio(['DSL', 'Fiber optic', 'No Internet'], label='What is your Internet Service?'),
31
+ gr.components.Radio(['No', 'Yes'], label='Do you have Online Security?'),
32
+ gr.components.Radio(['No', 'Yes'], label='Do you have Online Backup?'),
33
+ gr.components.Radio(['No', 'Yes'], label='Do you have Device Protection?')
34
+ ]
35
+
36
+ with gr.Column():
37
+ input_interface_column_2 = [
38
+ gr.components.Radio(['No', 'Yes'], label='Do you have Tech Support?'),
39
+ gr.components.Radio(['No', 'Yes'], label='Do you have Streaming TV?'),
40
+ gr.components.Radio(['No', 'Yes'], label='Do you have Streaming Movies?'),
41
+ gr.components.Radio(['Month-to-month', 'One year', 'Two year'], label='What is your Contract Type?'),
42
+ gr.components.Radio(['Yes', 'No'], label='Do you prefer Paperless Billing?'),
43
+ gr.components.Radio(['Electronic check', 'Mailed check', 'Bank transfer (automatic)', 'Credit card (automatic)'], label='Which PaymentMethod do you prefer?'),
44
+ gr.components.Slider(label="Enter monthly charges", minimum=18.40, maximum=118.65)
45
+ ]
46
+
47
+ with gr.Row():
48
+ input_interface.extend(input_interface_column_1)
49
+ input_interface.extend(input_interface_column_2)
 
 
 
 
50
 
51
+ with gr.Row():
52
+ predict_btn = gr.Button('Predict')
53
+ output_interface = gr.Label(label="churn")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
 
55
+ with gr.Accordion("Open for information on inputs", open=False):
56
+ gr.Markdown("""This app receives the following as inputs and processes them to return the prediction on whether a customer, will churn or not.
57
+
58
+ - SeniorCitizen: Whether a customer is a senior citizen or not
59
+ - Partner: Whether the customer has a partner or not (Yes, No)
60
+ - Dependents: Whether the customer has dependents or not (Yes, No)
61
+ - Tenure: Number of months the customer has stayed with the company
62
+ - InternetService: Customer's internet service provider (DSL, Fiber Optic, No)
63
+ - OnlineSecurity: Whether the customer has online security or not (Yes, No, No Internet)
64
+ - OnlineBackup: Whether the customer has online backup or not (Yes, No, No Internet)
65
+ - DeviceProtection: Whether the customer has device protection or not (Yes, No, No internet service)
66
+ - TechSupport: Whether the customer has tech support or not (Yes, No, No internet)
67
+ - StreamingTV: Whether the customer has streaming TV or not (Yes, No, No internet service)
68
+ - StreamingMovies: Whether the customer has streaming movies or not (Yes, No, No Internet service)
69
+ - Contract: The contract term of the customer (Month-to-Month, One year, Two year)
70
+ - PaperlessBilling: Whether the customer has paperless billing or not (Yes, No)
71
+ - Payment Method: The customer's payment method (Electronic check, mailed check, Bank transfer(automatic), Credit card(automatic))
72
+ - MonthlyCharges: The amount charged to the customer monthly
73
+ """)
74
+
75
+ predict_btn.click(fn=predict, inputs=input_interface, outputs=output_interface)
76
 
77
 
78