Spaces:
Sleeping
Sleeping
File size: 1,819 Bytes
ce55ba8 0ab1f67 ae7f490 564fde3 0ab1f67 564fde3 0ab1f67 564fde3 0ab1f67 564fde3 0ab1f67 564fde3 0ab1f67 564fde3 0ab1f67 |
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 |
import gradio as gr
from modules.sentiment import sentiment_function # โมดูลวิเคราะห์ความรู้สึก
from modules.financial_analyst import financial_analysis_function # โมดูลวิเคราะห์การเงิน
from modules.translator import text_translator # โมดูลแปลภาษา
from modules.personal_info_identifier import identify_personal_info # โมดูลตรวจสอบข้อมูลส่วนบุคคล
from modules.churn_analysis import churn_prediction # โมดูลทำนายการเลิกบริการ
def run_all_functions(input_text):
sentiment_result = sentiment_function(input_text)
financial_result = financial_analysis_function(input_text)
translation_result = text_translator(input_text, "English")
personal_info_result = identify_personal_info(input_text)
churn_result = churn_prediction(input_text)
return sentiment_result, financial_result, translation_result, personal_info_result, churn_result
with gr.Blocks() as demo:
gr.Markdown("# Multi-Function App")
gr.Markdown("### Combine various AI tasks into one platform")
text_input = gr.Textbox(label="Enter text to analyze")
sentiment_output = gr.Textbox(label="Sentiment Analysis")
financial_output = gr.Textbox(label="Financial Analysis")
translation_output = gr.Textbox(label="Translation Result")
personal_info_output = gr.Textbox(label="Personal Info Detection")
churn_output = gr.Textbox(label="Customer Churn Prediction")
run_button = gr.Button("Run All Functions")
run_button.click(fn=run_all_functions, inputs=text_input, outputs=[sentiment_output, financial_output, translation_output, personal_info_output, churn_output])
demo.launch()
|