|
|
|
import os |
|
import gradio as gr |
|
from deepface import DeepFace |
|
import matplotlib.pyplot as plt |
|
model_name = 'ArcFace' |
|
|
|
def get_deepface_verify(img1_path, img2_path, model_name): |
|
img1_detect= DeepFace.detectFace(img1_path) |
|
img2_detect= DeepFace.detectFace(img2_path) |
|
|
|
result = DeepFace.verify(img1_path=img1_path,img2_path=img2_path,model_name = model_name) |
|
return result |
|
|
|
title = "DeepFace" |
|
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." |
|
examples=[["10Jan_1.jpeg"],["10Jan_2.jpeg"]] |
|
|
|
facial_attribute_demo = gr.Interface(get_deepface_verify, inputs = ["image","image"],outputs="json",title=title, |
|
description=description,enable_queue=True,examples=[["10Jan_1.jpeg"]],cache_examples=False) |
|
|
|
|
|
|
|
from Deepface_analyze import facial_attribute_demo |
|
|
|
|
|
facial_attribute_demo.launch(debug=True) |
|
|
|
demo = gr.TabbedInterface([facial_attribute_demo , facial_attribute_demo], ["Deepface-Verify","Deepface-analyze"]) |
|
if __name__ == "__main__": |
|
demo.launch() |