Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,10 +1,41 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
|
| 3 |
-
# from modules.translator import translator_interface
|
| 4 |
-
from modules.translator import text_translator_ui
|
| 5 |
|
|
|
|
| 6 |
with gr.Blocks() as app:
|
|
|
|
|
|
|
| 7 |
with gr.Tab("Text Translator"):
|
| 8 |
-
|
|
|
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from modules.churn_analysis import predict
|
|
|
|
|
|
|
| 3 |
|
| 4 |
+
# Existing Tabs with Gradio Blocks
|
| 5 |
with gr.Blocks() as app:
|
| 6 |
+
|
| 7 |
+
# Add the Text Translator Tab
|
| 8 |
with gr.Tab("Text Translator"):
|
| 9 |
+
# Code for your text translator here (from previous code)
|
| 10 |
+
pass
|
| 11 |
|
| 12 |
+
# Add the Churn Analysis Tab
|
| 13 |
+
with gr.Tab("Churn Analysis"):
|
| 14 |
+
gr.Markdown("Customer Churn Prediction")
|
| 15 |
+
|
| 16 |
+
# Define your inputs for churn prediction
|
| 17 |
+
with gr.Row():
|
| 18 |
+
input_interface = [
|
| 19 |
+
gr.Radio(['Yes', 'No'], label="Are you a Senior Citizen?"),
|
| 20 |
+
gr.Radio(['Yes', 'No'], label="Do you have a Partner?"),
|
| 21 |
+
gr.Radio(['No', 'Yes'], label="Do you have Dependents?"),
|
| 22 |
+
gr.Slider(minimum=1, maximum=73, step=1, label="Tenure (in months)"),
|
| 23 |
+
gr.Radio(['DSL', 'Fiber optic', 'No Internet'], label="Internet Service"),
|
| 24 |
+
gr.Radio(['No', 'Yes'], label="Do you have Online Security?"),
|
| 25 |
+
gr.Radio(['No', 'Yes'], label="Do you have Online Backup?"),
|
| 26 |
+
gr.Radio(['No', 'Yes'], label="Do you have Device Protection?"),
|
| 27 |
+
gr.Radio(['No', 'Yes'], label="Do you have Tech Support?"),
|
| 28 |
+
gr.Radio(['No', 'Yes'], label="Do you have Streaming TV?"),
|
| 29 |
+
gr.Radio(['No', 'Yes'], label="Do you have Streaming Movies?"),
|
| 30 |
+
gr.Radio(['Month-to-month', 'One year', 'Two year'], label="Contract Type"),
|
| 31 |
+
gr.Radio(['Yes', 'No'], label="Paperless Billing?"),
|
| 32 |
+
gr.Radio(['Electronic check', 'Mailed check', 'Bank transfer (automatic)', 'Credit card (automatic)'], label="Payment Method"),
|
| 33 |
+
gr.Slider(minimum=18.40, maximum=118.65, label="Monthly Charges")
|
| 34 |
+
]
|
| 35 |
+
|
| 36 |
+
output_interface = gr.Label(label="Churn Prediction")
|
| 37 |
+
|
| 38 |
+
predict_btn = gr.Button('Predict Churn')
|
| 39 |
+
predict_btn.click(fn=predict, inputs=input_interface, outputs=output_interface)
|
| 40 |
+
|
| 41 |
+
app.launch(share=True)
|