GCLing commited on
Commit
99268d3
·
verified ·
1 Parent(s): 4188b4f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -64,7 +64,7 @@ def predict_text_mixed(text: str):
64
  return {cn: res[top_emo]}
65
  try:
66
  out = zero_shot(text, candidate_labels=candidate_labels,
67
- hypothesis_template="这句话表达了{}情绪")
68
  result = {}
69
  for lab, sc in zip(out["labels"], out["scores"]):
70
  cn = label_map_en2cn.get(lab.lower(), lab)
@@ -122,7 +122,7 @@ with gr.Blocks() as demo:
122
  gr.Markdown("### 臉部情緒 (即時 Webcam Streaming 分析)")
123
  with gr.Row():
124
  webcam = gr.Image(source="webcam", streaming=True, type="numpy", label="攝像頭畫面")
125
- face_out = gr.Label(label="情緒分布")
126
  webcam.stream(fn=predict_face, inputs=webcam, outputs=face_out)
127
  # 語音情緒 Tab
128
  with gr.TabItem("語音情緒"):
 
64
  return {cn: res[top_emo]}
65
  try:
66
  out = zero_shot(text, candidate_labels=candidate_labels,
67
+ hypothesis_template="這句話表達了{}情緒")
68
  result = {}
69
  for lab, sc in zip(out["labels"], out["scores"]):
70
  cn = label_map_en2cn.get(lab.lower(), lab)
 
122
  gr.Markdown("### 臉部情緒 (即時 Webcam Streaming 分析)")
123
  with gr.Row():
124
  webcam = gr.Image(source="webcam", streaming=True, type="numpy", label="攝像頭畫面")
125
+ face_out = gr.JSON(label="情緒原始結果")
126
  webcam.stream(fn=predict_face, inputs=webcam, outputs=face_out)
127
  # 語音情緒 Tab
128
  with gr.TabItem("語音情緒"):