Spaces:
Runtime error
Runtime error
ParisNeo
commited on
Commit
·
5edaec9
1
Parent(s):
de2f085
upgraded
Browse files
app.py
CHANGED
@@ -12,16 +12,24 @@ from pathlib import Path
|
|
12 |
import cv2
|
13 |
import time
|
14 |
|
|
|
15 |
from FaceAnalyzer import FaceAnalyzer
|
16 |
|
|
|
17 |
from pathlib import Path
|
18 |
import pickle
|
|
|
19 |
from tqdm import tqdm # used to draw a progress bar pip install tqdm
|
|
|
|
|
20 |
from deepface import DeepFace
|
21 |
|
22 |
# Number of images to use to build the embedding
|
23 |
nb_images=50
|
24 |
|
|
|
|
|
|
|
25 |
|
26 |
|
27 |
# If faces path is empty then make it
|
@@ -59,6 +67,7 @@ class UI():
|
|
59 |
self.current_name = None
|
60 |
self.current_face_files = []
|
61 |
self.draw_landmarks = True
|
|
|
62 |
|
63 |
with gr.Blocks() as demo:
|
64 |
gr.Markdown("## FaceAnalyzer face recognition test")
|
@@ -115,6 +124,7 @@ class UI():
|
|
115 |
headers=["Face Name"],
|
116 |
datatype=["str"],
|
117 |
label="Faces",
|
|
|
118 |
)
|
119 |
with gr.Row():
|
120 |
with gr.Accordion(label="Options", open=False):
|
@@ -125,7 +135,6 @@ class UI():
|
|
125 |
self.cb_draw_landmarks = gr.Checkbox(label="Draw landmarks", value=True)
|
126 |
self.cb_draw_landmarks.change(self.set_draw_landmarks, self.cb_draw_landmarks)
|
127 |
|
128 |
-
self.upgrade_faces()
|
129 |
demo.queue().launch()
|
130 |
def add_files(self, files):
|
131 |
for file in files:
|
@@ -168,7 +177,8 @@ class UI():
|
|
168 |
finger_print = pickle.load(f)
|
169 |
self.known_faces.append(finger_print)
|
170 |
self.known_faces_names.append(file.stem)
|
171 |
-
self
|
|
|
172 |
|
173 |
def set_face_name(self, face_name):
|
174 |
self.face_name=face_name
|
|
|
12 |
import cv2
|
13 |
import time
|
14 |
|
15 |
+
from numpy.lib.type_check import imag
|
16 |
from FaceAnalyzer import FaceAnalyzer
|
17 |
|
18 |
+
import matplotlib.pyplot as plt
|
19 |
from pathlib import Path
|
20 |
import pickle
|
21 |
+
import tensorflow as tf
|
22 |
from tqdm import tqdm # used to draw a progress bar pip install tqdm
|
23 |
+
import tkinter as tk
|
24 |
+
from tkinter import simpledialog
|
25 |
from deepface import DeepFace
|
26 |
|
27 |
# Number of images to use to build the embedding
|
28 |
nb_images=50
|
29 |
|
30 |
+
# create Tkinter root window
|
31 |
+
root = tk.Tk()
|
32 |
+
root.withdraw()
|
33 |
|
34 |
|
35 |
# If faces path is empty then make it
|
|
|
67 |
self.current_name = None
|
68 |
self.current_face_files = []
|
69 |
self.draw_landmarks = True
|
70 |
+
self.upgrade_faces()
|
71 |
|
72 |
with gr.Blocks() as demo:
|
73 |
gr.Markdown("## FaceAnalyzer face recognition test")
|
|
|
124 |
headers=["Face Name"],
|
125 |
datatype=["str"],
|
126 |
label="Faces",
|
127 |
+
value=[[n] for n in self.known_faces_names]
|
128 |
)
|
129 |
with gr.Row():
|
130 |
with gr.Accordion(label="Options", open=False):
|
|
|
135 |
self.cb_draw_landmarks = gr.Checkbox(label="Draw landmarks", value=True)
|
136 |
self.cb_draw_landmarks.change(self.set_draw_landmarks, self.cb_draw_landmarks)
|
137 |
|
|
|
138 |
demo.queue().launch()
|
139 |
def add_files(self, files):
|
140 |
for file in files:
|
|
|
177 |
finger_print = pickle.load(f)
|
178 |
self.known_faces.append(finger_print)
|
179 |
self.known_faces_names.append(file.stem)
|
180 |
+
if hasattr(self, "faces_list"):
|
181 |
+
self.faces_list.update([self.known_faces])
|
182 |
|
183 |
def set_face_name(self, face_name):
|
184 |
self.face_name=face_name
|