Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -58,11 +58,21 @@ def predict(frame):
|
|
58 |
|
59 |
return frameClone, probs
|
60 |
|
61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
out = [
|
63 |
-
|
64 |
-
|
65 |
-
]
|
|
|
|
|
66 |
title = "Facial Emotion Recognition"
|
67 |
description = "How well can this model predict your emotions? Take a picture with your webcam, and it will guess if" \
|
68 |
" you are: happy, sad, angry, disgusted, scared, surprised, or neutral."
|
@@ -71,3 +81,10 @@ thumbnail = "https://raw.githubusercontent.com/gradio-app/hub-emotion-recognitio
|
|
71 |
# gr.Interface(predict, inp, out, capture_session=True, title=title, thumbnail=thumbnail,
|
72 |
# description=description).launch(inbrowser=True)
|
73 |
gr.Interface(fn=predict, inputs=inp, outputs=out, title=title, thumbnail=thumbnail).launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
|
59 |
return frameClone, probs
|
60 |
|
61 |
+
# Define Gradio input and output components
|
62 |
+
image_input = gr.components.Image(type='file', label="Upload Image or Video")
|
63 |
+
image_output = gr.components.Image(label="Predicted Emotion")
|
64 |
+
label_output = gr.components.Label(num_top_classes=2, label="Top 2 Probabilities")
|
65 |
+
|
66 |
+
inp = [
|
67 |
+
gr.components.Image(sources="webcam", label="Your face"),
|
68 |
+
gr.components.Image(type='file', label="Upload Image or Video")
|
69 |
+
]
|
70 |
out = [
|
71 |
+
gr.components.Image(label="Predicted Emotion"),
|
72 |
+
gr.components.Label(num_top_classes=2, label="Top 2 Probabilities")
|
73 |
+
]
|
74 |
+
|
75 |
+
|
76 |
title = "Facial Emotion Recognition"
|
77 |
description = "How well can this model predict your emotions? Take a picture with your webcam, and it will guess if" \
|
78 |
" you are: happy, sad, angry, disgusted, scared, surprised, or neutral."
|
|
|
81 |
# gr.Interface(predict, inp, out, capture_session=True, title=title, thumbnail=thumbnail,
|
82 |
# description=description).launch(inbrowser=True)
|
83 |
gr.Interface(fn=predict, inputs=inp, outputs=out, title=title, thumbnail=thumbnail).launch()
|
84 |
+
|
85 |
+
|
86 |
+
|
87 |
+
|
88 |
+
# # Launch Gradio interface
|
89 |
+
# gr.Interface(fn=predict, inputs=image_input, outputs=[image_output, label_output],
|
90 |
+
# title="Facial Emotion Recognition", description="How well can this model predict your emotions?").launch()
|