Update app.py
Browse files
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.
|
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("語音情緒"):
|