File size: 1,400 Bytes
a6ffd08
 
 
 
 
 
 
 
55285fe
 
 
 
 
 
 
 
 
 
 
 
a6ffd08
 
 
 
 
 
 
 
35972d5
a6ffd08
 
 
 
 
35972d5
a6ffd08
0c23e21
 
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
37
38
39
40
41
42
43
44
45
#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")


!curl -O https://huggingface.co/spaces/ipvikas/ImageProcessing/blob/main/PhotoDataSet.zip
!unzip -q PhotoDataSet.zip
!ls
!ls db_path
import os



#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=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()