Spaces:
Runtime error
Runtime error
Use gr.Interface with gr.inputs.Image for webcam support
Browse files
app.py
CHANGED
@@ -2,16 +2,17 @@ import gradio as gr
|
|
2 |
from deepface import DeepFace
|
3 |
|
4 |
def analyze_frame(frame):
|
5 |
-
#
|
6 |
result = DeepFace.analyze(frame, actions=['emotion'], enforce_detection=False)
|
7 |
return result['dominant_emotion']
|
8 |
|
9 |
-
|
10 |
-
|
11 |
-
gr.
|
12 |
-
|
13 |
-
|
14 |
-
|
|
|
15 |
|
16 |
if __name__ == "__main__":
|
17 |
demo.launch()
|
|
|
2 |
from deepface import DeepFace
|
3 |
|
4 |
def analyze_frame(frame):
|
5 |
+
# frame θΏιε°±ζ―δ»ζε倴ζε°η numpy array
|
6 |
result = DeepFace.analyze(frame, actions=['emotion'], enforce_detection=False)
|
7 |
return result['dominant_emotion']
|
8 |
|
9 |
+
demo = gr.Interface(
|
10 |
+
fn=analyze_frame,
|
11 |
+
inputs=gr.inputs.Image(source="webcam", label="ε°ζΊδ½ ηθ"),
|
12 |
+
outputs=gr.outputs.Textbox(label="θε₯ε°ηζ
η·"),
|
13 |
+
title="π± ζζ©η覽ε¨ε³ζθι¨ζ
η·εζ",
|
14 |
+
live=True
|
15 |
+
)
|
16 |
|
17 |
if __name__ == "__main__":
|
18 |
demo.launch()
|