GCLing commited on
Commit
b9af6a3
·
verified ·
1 Parent(s): 2a89f5d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -9
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.Blocks() as demo:
181
- with gr.TabItem("文字情緒"):
182
- gr.Markdown("### 文字情緒 分析 (规则+zero-shot)")
183
- with gr.Row():
184
- text = gr.Textbox(lines=3, placeholder="請輸入中文文字…")
185
- text_out = gr.Label(label="文字情緒結果")
186
- btn = gr.Button("分析")
187
- btn.click(fn=predict_text_mixed, inputs=text, outputs=text_out)
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()