|
import gradio as gr |
|
import pathlib |
|
from deepface import DeepFace |
|
|
|
|
|
|
|
|
|
db_path= [[path.as_posix()] for path in sorted(pathlib.Path('Image_DATA').rglob('*.j*g'))] |
|
|
|
|
|
|
|
|
|
|
|
import pandas as pd |
|
def get_deepface(image): |
|
df = DeepFace.find(img_path=image, db_path=db_path) |
|
d = DeepFace.analyze(img_path=image) |
|
|
|
|
|
return d |
|
|
|
description = "Deepface is a lightweight face recognition and facial attribute analysis (age, gender, emotion and race) framework for python. It is a hybrid face recognition framework wrapping state-of-the-art models: VGG-Face, Google FaceNet, OpenFace, Facebook DeepFace, DeepID, ArcFace and Dlib." |
|
|
|
facial_attribute_demo = gr.Interface( |
|
fn=get_deepface, |
|
inputs="image", |
|
outputs=['text'], |
|
title="face recognition and facial attribute analysis", |
|
description=description, |
|
enable_queue=True, |
|
examples=[["10Jan_1.jpeg"]], |
|
cache_examples=False) |
|
|
|
|