IS361Group4 commited on
Commit
08469de
·
verified ·
1 Parent(s): 4a2267c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -24
app.py CHANGED
@@ -1,32 +1,24 @@
1
  import gradio as gr
2
- from modules.sentiment import sentiment_function # โมดูลวิเคราะห์ความรู้สึก
3
- from modules.financial_analyst import financial_analysis_function # โมดูลวิเคราะห์การเงิน
4
- from modules.translator import text_translator # โมดูลแปลภาษา
5
- from modules.personal_info_identifier import identify_personal_info # โมดูลตรวจสอบข้อมูลส่วนบุคคล
6
- from modules.churn_analysis import churn_prediction # โมดูลทำนายการเลิกบริการ
7
 
8
- def run_all_functions(input_text):
9
- sentiment_result = sentiment_function(input_text)
10
- financial_result = financial_analysis_function(input_text)
11
- translation_result = text_translator(input_text, "English")
12
- personal_info_result = identify_personal_info(input_text)
13
- churn_result = churn_prediction(input_text)
14
- return sentiment_result, financial_result, translation_result, personal_info_result, churn_result
15
 
16
- with gr.Blocks() as demo:
17
- gr.Markdown("# Multi-Function App")
18
- gr.Markdown("### Combine various AI tasks into one platform")
19
 
20
- text_input = gr.Textbox(label="Enter text to analyze")
 
21
 
22
- sentiment_output = gr.Textbox(label="Sentiment Analysis")
23
- financial_output = gr.Textbox(label="Financial Analysis")
24
- translation_output = gr.Textbox(label="Translation Result")
25
- personal_info_output = gr.Textbox(label="Personal Info Detection")
26
- churn_output = gr.Textbox(label="Customer Churn Prediction")
27
 
28
- run_button = gr.Button("Run All Functions")
 
29
 
30
- run_button.click(fn=run_all_functions, inputs=text_input, outputs=[sentiment_output, financial_output, translation_output, personal_info_output, churn_output])
 
31
 
32
- demo.launch()
 
 
 
 
1
  import gradio as gr
 
 
 
 
 
2
 
3
+ # นำเข้าโมดูลแต่ละตัวจากโฟลเดอร์ modules
4
+ from modules import sentiment, financial_analyst, translator, personal_info_identifier, churn_analysis
 
 
 
 
 
5
 
6
+ with gr.Blocks(title="All-in-One AI App") as app:
7
+ gr.Markdown("# 🤖 All-in-One AI Utilities App")
 
8
 
9
+ with gr.Tab("🌍 Text Translator"):
10
+ translator.demo.render()
11
 
12
+ with gr.Tab("😊 Sentiment Analysis"):
13
+ sentiment.demo.render()
 
 
 
14
 
15
+ with gr.Tab("📊 Financial Analyst AI"):
16
+ financial_analyst.demo.render()
17
 
18
+ with gr.Tab("🔍 Personal Info Identifier"):
19
+ personal_info_identifier.demo.render()
20
 
21
+ with gr.Tab("📈 Customer Churn Prediction"):
22
+ churn_analysis.app.render()
23
+
24
+ app.launch()