Spaces:
Runtime error
Runtime error
KupynOrest
commited on
Commit
·
5bc06d8
1
Parent(s):
55ff9f6
App update
Browse files
app.py
CHANGED
@@ -5,16 +5,26 @@ from head_detector import HeadDetector
|
|
5 |
import gradio as gr
|
6 |
|
7 |
detector = HeadDetector()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
|
10 |
-
def detect_faces(image):
|
11 |
-
image = detector(image).draw()
|
12 |
return image
|
13 |
|
14 |
|
15 |
iface = gr.Interface(
|
16 |
fn=detect_faces,
|
17 |
-
inputs=
|
|
|
|
|
|
|
18 |
outputs=gr.outputs.Image(type="numpy", label="Image with Faces"),
|
19 |
title="Demo of: VGGHeads: A Large-Scale Synthetic Dataset for 3D Human Heads",
|
20 |
description="Upload an image. The model performs simultaneous heads detection and head meshes reconstruction from a single image in a single step.",
|
|
|
5 |
import gradio as gr
|
6 |
|
7 |
detector = HeadDetector()
|
8 |
+
INVERSE_MAPPING = {
|
9 |
+
'Full': 'full',
|
10 |
+
'Head Boxes': 'bbox',
|
11 |
+
'Face Landmarks': 'points',
|
12 |
+
'Head Landmarks': 'landmarks',
|
13 |
+
'Head Pose': 'pose'
|
14 |
+
}
|
15 |
|
16 |
|
17 |
+
def detect_faces(image, method):
|
18 |
+
image = detector(image).draw(method=INVERSE_MAPPING[method])
|
19 |
return image
|
20 |
|
21 |
|
22 |
iface = gr.Interface(
|
23 |
fn=detect_faces,
|
24 |
+
inputs=[
|
25 |
+
gr.inputs.Image(type="numpy", label="Upload an Image"),
|
26 |
+
gr.inputs.Radio(['Full', 'Head Boxes', 'Face Landmarks', 'Head Landmarks', 'Head Pose'], label="Face Detection Method", default='Full')
|
27 |
+
],
|
28 |
outputs=gr.outputs.Image(type="numpy", label="Image with Faces"),
|
29 |
title="Demo of: VGGHeads: A Large-Scale Synthetic Dataset for 3D Human Heads",
|
30 |
description="Upload an image. The model performs simultaneous heads detection and head meshes reconstruction from a single image in a single step.",
|