Team Ai
Apppublic

ipvikas/ImageProcessing

sourceHugging Faceupdated 1y agoView on Hugging Face
3likes
app_1.py32 linesDownload Raw Back to root
1#ALL as a whole2import os3import gradio as gr4from deepface import DeepFace5import matplotlib.pyplot as plt6model_name = 'ArcFace'  #VGG-Face, Facenet, OpenFace, DeepFace, DeepID, Dlib, ArcFace or Ensemble7 8def get_deepface_verify(img1_path, img2_path, model_name):9    img1_detect= DeepFace.detectFace(img1_path)10    img2_detect= DeepFace.detectFace(img2_path)11    12    result = DeepFace.verify(img1_path=img1_path,img2_path=img2_path,model_name = model_name)13    return result14 15title = "DeepFace"16description = "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."17examples=[["10Jan_1.jpeg"],["10Jan_2.jpeg"]]18 19facial_attribute_demo = gr.Interface(get_deepface_verify, inputs = ["image","image"],outputs="json",title=title,20    description=description,enable_queue=True,examples=[["10Jan_1.jpeg"]],cache_examples=False)21 22 23#########################324from Deepface_analyze import facial_attribute_demo25 26 27facial_attribute_demo.launch(debug=True)28####################29demo = gr.TabbedInterface([facial_attribute_demo , facial_attribute_demo], ["Deepface-Verify","Deepface-analyze"])30if __name__ == "__main__":31    demo.launch()32