File size: 1,350 Bytes
5e8395e
c3143ea
4eddd18
 
 
4ff0905
1ed5ce5
4915b46
 
 
 
54e742e
4ff0905
 
4915b46
c3143ea
5e8395e
59ece0e
4915b46
c3143ea
4915b46
c3143ea
 
 
 
 
 
 
 
 
54e742e
c3143ea
 
 
 
59ece0e
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import gradio as gr
import os
from src.face_texture import GetFaceTexture
from src.face_symmetry import GetFaceSymmetry
from src.face_demographics import GetFaceDemographics
from src.face_proportions import GetFaceProportions


def combined_fn(input_image):
    texture_results = GetFaceTexture().main(input_image)
    symmetry_results = GetFaceSymmetry().main(input_image)
    demographics_results = GetFaceDemographics().main(input_image)
    proportion_results = GetFaceProportions().main(input_image)
    return (*texture_results, *symmetry_results, demographics_results, *proportion_results)

gigi_hadid = os.path.join(os.path.dirname(__file__), "data/gigi_hadid.webp")

iface = gr.Interface(
    fn=combined_fn,
    inputs=gr.Image(type="pil", label="Upload Face Image", value=gigi_hadid),
    outputs=[
        gr.Image(type="pil", label="Extracted face"),
        gr.Image(type="pil", label="Extracted face texture"), 
        "json",
        gr.Image(type="pil", label="Face symmetry"),  
        "json",
        "json",
        "json",
        "json",
        gr.Image(type="pil", label="Face landmarks"),
    ],
    title="Advanced Facial Feature Detector",
    description="A comprehensive tool for detailed face analysis. Please upload a clear face image for best results.",
    theme=gr.themes.Soft(),
    live=False,
)

iface.launch()