Update app.py
Browse files
app.py
CHANGED
@@ -121,14 +121,15 @@ with gr.Blocks() as demo:
|
|
121 |
with gr.TabItem("臉部情緒"):
|
122 |
gr.Markdown("### 臉部情緒 (即時 Webcam Streaming 分析)")
|
123 |
with gr.Row():
|
124 |
-
webcam = gr.Image(
|
125 |
face_out = gr.JSON(label="情緒原始結果")
|
126 |
webcam.stream(fn=predict_face, inputs=webcam, outputs=face_out)
|
127 |
# 語音情緒 Tab
|
128 |
with gr.TabItem("語音情緒"):
|
129 |
gr.Markdown("### 語音情緒 分析")
|
130 |
with gr.Row():
|
131 |
-
audio = gr.Audio(
|
|
|
132 |
voice_out = gr.Label(label="語音情緒結果")
|
133 |
audio.change(fn=predict_voice, inputs=audio, outputs=voice_out)
|
134 |
# 文字情緒 Tab
|
|
|
121 |
with gr.TabItem("臉部情緒"):
|
122 |
gr.Markdown("### 臉部情緒 (即時 Webcam Streaming 分析)")
|
123 |
with gr.Row():
|
124 |
+
webcam = gr.Image(sources="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("語音情緒"):
|
129 |
gr.Markdown("### 語音情緒 分析")
|
130 |
with gr.Row():
|
131 |
+
audio = gr.Audio(sources="microphone", streaming=False, type="filepath", label="錄音")
|
132 |
+
|
133 |
voice_out = gr.Label(label="語音情緒結果")
|
134 |
audio.change(fn=predict_voice, inputs=audio, outputs=voice_out)
|
135 |
# 文字情緒 Tab
|