Update app.py
Browse files
app.py
CHANGED
|
@@ -177,15 +177,17 @@ with gr.Blocks() as demo:
|
|
| 177 |
voice_out = gr.Label(label="語音情緒結果")
|
| 178 |
audio.change(fn=predict_voice, inputs=audio, outputs=voice_out)
|
| 179 |
# 文字情緒 Tab
|
| 180 |
-
with gr.
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
|
|
|
| 189 |
|
| 190 |
if __name__ == "__main__":
|
|
|
|
| 191 |
demo.launch()
|
|
|
|
| 177 |
voice_out = gr.Label(label="語音情緒結果")
|
| 178 |
audio.change(fn=predict_voice, inputs=audio, outputs=voice_out)
|
| 179 |
# 文字情緒 Tab
|
| 180 |
+
with gr.TabItem("文字情緒"):
|
| 181 |
+
gr.Markdown("### 文字情緒 分析 (規則+zero-shot)")
|
| 182 |
+
with gr.Row():
|
| 183 |
+
text = gr.Textbox(lines=3, placeholder="請輸入中文文字…")
|
| 184 |
+
text_out = gr.Label(label="文字情緒結果")
|
| 185 |
+
# 可以用回車提交
|
| 186 |
+
btn = gr.Button("分析")
|
| 187 |
+
btn.click(fn=predict_text_mixed, inputs=text, outputs=text_out)
|
| 188 |
+
|
| 189 |
+
return demo
|
| 190 |
|
| 191 |
if __name__ == "__main__":
|
| 192 |
+
demo = build_interface()
|
| 193 |
demo.launch()
|