ImageProcessing / app.py
ipvikas's picture
Update app.py
bd32536
raw
history blame
1.02 kB
import gradio as gr
from deepface import DeepFace
#db_path='https://github.com/ipvikas/MyPhotos'
from datasets import load_dataset
db_path= load_dataset("imagefolder", data_files="https://huggingface.co/spaces/ipvikas/ImageProcessing/blob/main/PhotoDataSet.zip")
import pandas as pd
def get_deepface(image):
df = DeepFace.find(img_path=image, db_path=db_path)
return DeepFace.analyze(img_path=image)
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)
facial_attribute_demo.launch()