Spaces:
Runtime error
Runtime error
Switch to gradio Blocks+components for webcam
Browse files
app.py
CHANGED
@@ -1,16 +1,15 @@
|
|
1 |
-
|
2 |
from deepface import DeepFace
|
3 |
|
4 |
def analyze_frame(frame):
|
5 |
result = DeepFace.analyze(frame, actions=['emotion'], enforce_detection=False)
|
6 |
return result['dominant_emotion']
|
7 |
|
8 |
-
with
|
9 |
-
|
10 |
-
webcam =
|
11 |
-
emotion =
|
12 |
-
|
13 |
-
webcam.change(analyze_frame, inputs=webcam, outputs=emotion)
|
14 |
|
15 |
-
if __name__
|
16 |
demo.launch()
|
|
|
1 |
+
from gradio import Blocks, components
|
2 |
from deepface import DeepFace
|
3 |
|
4 |
def analyze_frame(frame):
|
5 |
result = DeepFace.analyze(frame, actions=['emotion'], enforce_detection=False)
|
6 |
return result['dominant_emotion']
|
7 |
|
8 |
+
with Blocks() as demo:
|
9 |
+
demo.markdown("## π± ζζ©η覽ε¨ε³ζθι¨ζ
η·εζ")
|
10 |
+
webcam = components.Image(source="webcam", tool="editor", label="ε°ζΊδ½ ηθ")
|
11 |
+
emotion = components.Textbox(label="θε₯ε°ηζ
η·")
|
12 |
+
webcam.change(fn=analyze_frame, inputs=webcam, outputs=emotion)
|
|
|
13 |
|
14 |
+
if __name__=="__main__":
|
15 |
demo.launch()
|