Test-Space / app.py
LiuPengNGP's picture
Update app.py
77ca99f verified
raw
history blame
1.26 kB
import gradio as gr
import my_uie
import face_emo_analysize
def text_emo_analysize(text):
text_outcome = my_uie.emo_analy(text)
return text_outcome
def face_emo_analyze():
# ๅ‡่ฎพ face_emo_analysize.face_emo_analysize() ไผšๆ‰“ๅผ€ๆ‘„ๅƒๅคดๅนถๆ•่Žท่กจๆƒ…
face_outcome = face_emo_analysize.face_emo_analysize()
return face_outcome
# ๅˆ›ๅปบGradio็•Œ้ข
with gr.Blocks() as demo:
gr.Markdown("# ๆƒ…ๆ„Ÿๅˆ†ๆžๅบ”็”จ")
gr.Markdown("่พ“ๅ…ฅไฟกๆฏ๏ผŒ่Žทๅ–ๆƒ…ๆ„Ÿๅˆ†ๆž็ป“ๆžœใ€‚")
with gr.Row():
with gr.Column():
text_input = gr.Textbox(lines=2, placeholder='ๅœจ่ฟ™้‡Œ่พ“ๅ…ฅๆ–‡ๆœฌ')
text_submit_button = gr.Button("ๆไบคๆ–‡ๆœฌๆƒ…ๆ„Ÿๅˆ†ๆž")
text_output = gr.Textbox(label="ๆ–‡ๆœฌๆƒ…ๆ„Ÿๅˆ†ๆž็ป“ๆžœ")
with gr.Row():
face_button = gr.Button("ๆ‰ง่กŒ้ข้ƒจๆƒ…ๆ„Ÿๅˆ†ๆž")
face_output = gr.Textbox(label="้ข้ƒจๆƒ…ๆ„Ÿๅˆ†ๆž็ป“ๆžœ")
def on_face_button_click():
# ่ฐƒ็”จ face_emo_analyze ๅ‡ฝๆ•ฐๅนถ่ฟ”ๅ›ž็ป“ๆžœ
face_outcome = face_emo_analyze()
return face_outcome
face_button.click(on_face_button_click, inputs=None, outputs=face_output)
text_submit_button.click(text_emo_analysize, inputs=text_input, outputs=text_output)
demo.launch()