Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -3,6 +3,12 @@ from deepface import DeepFace
|
|
3 |
from PIL import Image
|
4 |
import numpy as np
|
5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
# Analyze the uploaded image
|
7 |
def analyze_face(image):
|
8 |
analysis_result = DeepFace.analyze(img_path=np.array(image), actions=['age', 'gender', 'race', 'emotion'])[0]
|
@@ -26,7 +32,8 @@ iface = gr.Interface(
|
|
26 |
gr.Text(label="Gender Probability"),
|
27 |
gr.Text(label="Race"),
|
28 |
gr.Text(label="Dominant Emotion"),
|
29 |
-
gr.Text(label="Emotion Breakdown")]
|
|
|
30 |
)
|
31 |
|
32 |
# Launch the Gradio app
|
|
|
3 |
from PIL import Image
|
4 |
import numpy as np
|
5 |
|
6 |
+
# Example images for testing
|
7 |
+
example_images = [
|
8 |
+
"https://i.imgur.com/0qB8i4j.jpg", # Example Image 1
|
9 |
+
"https://i.imgur.com/4S8DgD1.jpg" # Example Image 2
|
10 |
+
]
|
11 |
+
|
12 |
# Analyze the uploaded image
|
13 |
def analyze_face(image):
|
14 |
analysis_result = DeepFace.analyze(img_path=np.array(image), actions=['age', 'gender', 'race', 'emotion'])[0]
|
|
|
32 |
gr.Text(label="Gender Probability"),
|
33 |
gr.Text(label="Race"),
|
34 |
gr.Text(label="Dominant Emotion"),
|
35 |
+
gr.Text(label="Emotion Breakdown")],
|
36 |
+
examples=example_images # Adding example images to the interface
|
37 |
)
|
38 |
|
39 |
# Launch the Gradio app
|