File size: 1,299 Bytes
a6ffd08
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#IMPORTANT PART ONLY
#!pip install deepface
import gradio as gr

from deepface import DeepFace
#from google.colab import drive
#drive.mount('/content/drive')
#img1_path = '/content/drive/My Drive/Colab Notebooks/DeepLearning/FaceRecognition/PhotoDataSet/10Jan_1.jpeg'
import zipfile
with zipfile.ZipFile("PhotoDataSet.zip","r") as zip_ref:
    zip_ref.extractall("db_path")

#db_path='/content/drive/My Drive/Colab Notebooks/DeepLearning/FaceRecognition/PhotoDataSet/'

import pandas as pd
def get_deepface(image):

    df = DeepFace.find(img_path=image, db_path=db_path)
    #print(df.head())
    return DeepFace.analyze(img_path=img1_path))


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=process_document,
    inputs="image",
    outputs="json",
    title="face recognition and facial attribute analysis (age, gender, emotion and race) framework",
    description=description,
    
    enable_queue=True,
    examples=[["10Jan_1.jpeg"]],
    cache_examples=False)

facial_attribute_demo .launch()