Spaces:
Runtime error
Runtime error
Pin gradio and use Blocks+Image for webcam
Browse files- app.py +6 -8
- requirements.txt +1 -1
app.py
CHANGED
@@ -2,17 +2,15 @@ import gradio as gr
|
|
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 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
)
|
16 |
|
17 |
if __name__ == "__main__":
|
18 |
demo.launch()
|
|
|
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 gr.Blocks() as demo:
|
9 |
+
gr.Markdown("## π± ζζ©η覽ε¨ε³ζθι¨ζ
η·εζ")
|
10 |
+
webcam = gr.Image(source="webcam", tool="editor", label="ε°ζΊδ½ ηθ")
|
11 |
+
emotion = gr.Textbox(label="θε₯ε°ηζ
η·")
|
12 |
+
# ζ―欑η»ι’ζ΄ζ°ε°±η΄ζ₯εζ
|
13 |
+
webcam.change(analyze_frame, inputs=webcam, outputs=emotion)
|
|
|
14 |
|
15 |
if __name__ == "__main__":
|
16 |
demo.launch()
|
requirements.txt
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
gradio
|
2 |
deepface
|
3 |
tensorflow
|
4 |
opencv-python
|
|
|
1 |
+
gradio==3.39.0
|
2 |
deepface
|
3 |
tensorflow
|
4 |
opencv-python
|