Spaces:
Sleeping
Sleeping
Commit
·
91d97ae
1
Parent(s):
fb46198
Update app.py
Browse files
app.py
CHANGED
@@ -37,28 +37,27 @@ def Attandance(video):
|
|
37 |
index=1
|
38 |
while True:
|
39 |
try:
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
break
|
62 |
return ''.join(name)
|
63 |
|
64 |
demo=gr.Interface(fn=Attandance,
|
|
|
37 |
index=1
|
38 |
while True:
|
39 |
try:
|
40 |
+
ret, frame = cap.read()
|
41 |
+
#faces = cv2.resize(frame, (0, 0), None, 0.25, 0.25)
|
42 |
+
faces = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
|
43 |
+
|
44 |
+
facesCurrentFrame = face_recognition.face_locations(faces)
|
45 |
+
encodesCurrentFrame = face_recognition.face_encodings(faces, facesCurrentFrame)
|
46 |
+
|
47 |
+
for encodeFace, faceLoc in zip(encodesCurrentFrame, facesCurrentFrame):
|
48 |
+
matches = face_recognition.compare_faces(encodeListKnown, encodeFace)
|
49 |
+
faceDis = face_recognition.face_distance(encodeListKnown, encodeFace)
|
50 |
+
# print(faceDis)
|
51 |
+
matchIndex = np.argmin(faceDis)
|
52 |
+
|
53 |
+
if matches[matchIndex]:
|
54 |
+
name = personNames[matchIndex].upper()
|
55 |
+
if names.count(name) == 0:
|
56 |
+
names.append(name)
|
57 |
+
|
58 |
+
cv2.waitKey(1)
|
59 |
+
except:
|
60 |
+
break
|
|
|
61 |
return ''.join(name)
|
62 |
|
63 |
demo=gr.Interface(fn=Attandance,
|