File size: 2,035 Bytes
36b054b
2a72ef1
 
c8166ff
564fde3
3c76263
 
c68f7bf
dc0350d
564fde3
db19c65
 
 
 
88068a7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
db19c65
 
 
 
 
88068a7
 
 
 
db19c65
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import gradio as gr
from churn_analysis import predict
from translator import text_translator_ui
from sentiment import create_sentiment_tab

with gr.Blocks() as app:
    with gr.Tab("Text Translator"):
        text_translator_ui()
        pass

    # Add the Churn Analysis Tab
    with gr.Tab("Churn Analysis"):
        gr.Markdown("Customer Churn Prediction")
        
    # Define your inputs for churn prediction
    with gr.Row():
        input_interface = [
            gr.Radio(['Yes', 'No'], label="Are you a Senior Citizen?"),
            gr.Radio(['Yes', 'No'], label="Do you have a Partner?"),
            gr.Radio(['No', 'Yes'], label="Do you have Dependents?"),
            gr.Slider(minimum=1, maximum=73, step=1, label="Tenure (in months)"),
            gr.Radio(['DSL', 'Fiber optic', 'No Internet'], label="Internet Service"),
            gr.Radio(['No', 'Yes'], label="Do you have Online Security?"),
            gr.Radio(['No', 'Yes'], label="Do you have Online Backup?"),
            gr.Radio(['No', 'Yes'], label="Do you have Device Protection?"),
            gr.Radio(['No', 'Yes'], label="Do you have Tech Support?"),
            gr.Radio(['No', 'Yes'], label="Do you have Streaming TV?"),
            gr.Radio(['No', 'Yes'], label="Do you have Streaming Movies?"),
            gr.Radio(['Month-to-month', 'One year', 'Two year'], label="Contract Type"),
            gr.Radio(['Yes', 'No'], label="Paperless Billing?"),
            gr.Radio(['Electronic check', 'Mailed check', 'Bank transfer (automatic)', 'Credit card (automatic)'], label="Payment Method"),
            gr.Slider(minimum=18.40, maximum=118.65, label="Monthly Charges")
        ]
        
        output_interface = gr.Label(label="Churn Prediction")
        
        predict_btn = gr.Button('Predict Churn')
        predict_btn.click(fn=predict, inputs=input_interface, outputs=output_interface)

    with gr.Tab("Sentiment Analysis"):
        sentiment_app = create_sentiment_tab()
        sentiment_app.launch
        
app.launch(share=True)