ipvikas commited on
Commit
bd32536
·
1 Parent(s): 9b0e6f7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -15
app.py CHANGED
@@ -1,27 +1,17 @@
1
- #IMPORTANT PART ONLY
2
- #!pip install deepface
3
  import gradio as gr
4
-
5
  from deepface import DeepFace
6
- #from google.colab import drive
7
- #drive.mount('/content/drive')
8
- #img1_path = '/content/drive/My Drive/Colab Notebooks/DeepLearning/FaceRecognition/PhotoDataSet/10Jan_1.jpeg'
9
- #import zipfile
10
- #with zipfile.ZipFile("PhotoDataSet.zip","r") as zip_ref:
11
- #zip_ref.extractall("db_path")
12
 
 
13
 
 
 
14
 
15
- db_path='https://github.com/ipvikas/MyPhotos'
16
 
17
  import pandas as pd
18
  def get_deepface(image):
19
-
20
- df = DeepFace.find(img_path=image, db_path='https://github.com/ipvikas/MyPhotos')
21
- #print(df.head())
22
  return DeepFace.analyze(img_path=image)
23
 
24
-
25
  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."
26
 
27
  facial_attribute_demo = gr.Interface(
@@ -30,7 +20,6 @@ facial_attribute_demo = gr.Interface(
30
  outputs=['text'],
31
  title="face recognition and facial attribute analysis",
32
  description=description,
33
-
34
  enable_queue=True,
35
  examples=[["10Jan_1.jpeg"]],
36
  cache_examples=False)
 
 
 
1
  import gradio as gr
 
2
  from deepface import DeepFace
 
 
 
 
 
 
3
 
4
+ #db_path='https://github.com/ipvikas/MyPhotos'
5
 
6
+ from datasets import load_dataset
7
+ db_path= load_dataset("imagefolder", data_files="https://huggingface.co/spaces/ipvikas/ImageProcessing/blob/main/PhotoDataSet.zip")
8
 
 
9
 
10
  import pandas as pd
11
  def get_deepface(image):
12
+ df = DeepFace.find(img_path=image, db_path=db_path)
 
 
13
  return DeepFace.analyze(img_path=image)
14
 
 
15
  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."
16
 
17
  facial_attribute_demo = gr.Interface(
 
20
  outputs=['text'],
21
  title="face recognition and facial attribute analysis",
22
  description=description,
 
23
  enable_queue=True,
24
  examples=[["10Jan_1.jpeg"]],
25
  cache_examples=False)