create-app.py
Browse files
app.py
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#ALL as a whole
|
2 |
+
import os
|
3 |
+
import gradio as gr
|
4 |
+
from deepface import DeepFace
|
5 |
+
import matplotlib.pyplot as plt
|
6 |
+
model_name = 'ArcFace' #VGG-Face, Facenet, OpenFace, DeepFace, DeepID, Dlib, ArcFace or Ensemble
|
7 |
+
|
8 |
+
def 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 result
|
14 |
+
|
15 |
+
title = "DeepFace"
|
16 |
+
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."
|
17 |
+
examples=[["10Jan_1.jpeg"],["10Jan_2.jpeg"]]
|
18 |
+
|
19 |
+
facial_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 |
+
#########################3
|
24 |
+
from Deepface_analyze import facial_attribute_demo
|
25 |
+
|
26 |
+
|
27 |
+
facial_attribute_demo.launch(debug=True)
|
28 |
+
####################
|
29 |
+
demo = gr.TabbedInterface([facial_attribute_demo , facial_attribute_demo], ["Deepface-Verify","Deepface-analyze"])
|
30 |
+
if __name__ == "__main__":
|
31 |
+
demo.launch()
|