Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -42,14 +42,20 @@ def predict(frame_or_path):
|
|
42 |
return frame, {emotion: float(prob) for emotion, prob in zip(EMOTIONS, preds)}
|
43 |
|
44 |
# Define input and output components for Gradio
|
45 |
-
|
46 |
-
|
47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
|
49 |
# Launch the Gradio interface
|
50 |
title = "Facial Emotion Recognition"
|
51 |
description = "How well can this model predict your emotions? Take a picture with your webcam, or upload an image, and it will guess if you are happy, sad, angry, disgusted, scared, surprised, or neutral."
|
52 |
thumbnail = "https://raw.githubusercontent.com/gradio-app/hub-emotion-recognition/master/thumbnail.png"
|
53 |
|
54 |
-
gr.Interface(fn=predict, inputs=image_input, outputs=
|
55 |
title=title, description=description, thumbnail=thumbnail).launch()
|
|
|
42 |
return frame, {emotion: float(prob) for emotion, prob in zip(EMOTIONS, preds)}
|
43 |
|
44 |
# Define input and output components for Gradio
|
45 |
+
|
46 |
+
image_input = [
|
47 |
+
gr.components.Image(sources="webcam", label="Your face"),
|
48 |
+
gr.components.File(label="Upload Image or Video")
|
49 |
+
]
|
50 |
+
output = [
|
51 |
+
gr.components.Image(label="Predicted Emotion"),
|
52 |
+
gr.components.Label(num_top_classes=2, label="Top 2 Probabilities")
|
53 |
+
]
|
54 |
|
55 |
# Launch the Gradio interface
|
56 |
title = "Facial Emotion Recognition"
|
57 |
description = "How well can this model predict your emotions? Take a picture with your webcam, or upload an image, and it will guess if you are happy, sad, angry, disgusted, scared, surprised, or neutral."
|
58 |
thumbnail = "https://raw.githubusercontent.com/gradio-app/hub-emotion-recognition/master/thumbnail.png"
|
59 |
|
60 |
+
gr.Interface(fn=predict, inputs=image_input, outputs=output,
|
61 |
title=title, description=description, thumbnail=thumbnail).launch()
|