Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,6 @@ from PIL import Image
|
|
3 |
import numpy as np
|
4 |
import cv2
|
5 |
import requests
|
6 |
-
|
7 |
import face_recognition
|
8 |
import os
|
9 |
from datetime import datetime
|
@@ -28,7 +27,6 @@ for cls in myList:
|
|
28 |
classnames.append(os.path.splitext(cls)[0])
|
29 |
st.write(classnames)
|
30 |
|
31 |
-
|
32 |
def findEncodings(Images):
|
33 |
encodeList = []
|
34 |
for img in Images:
|
@@ -37,7 +35,6 @@ def findEncodings(Images):
|
|
37 |
encodeList.append(encode)
|
38 |
return encodeList
|
39 |
|
40 |
-
|
41 |
encodeListknown = findEncodings(Images)
|
42 |
st.write('Encoding Complete')
|
43 |
|
@@ -62,13 +59,14 @@ if img_file_buffer is not None:
|
|
62 |
matchIndex = np.argmin(faceDis)
|
63 |
|
64 |
if matches[matchIndex]:
|
65 |
-
name = classnames[matchIndex]
|
66 |
st.write(name)
|
67 |
y1, x2, y2, x1 = faceLoc
|
68 |
y1, x2, y2, x1 = y1*4,x2*4,y2*4,x1*4
|
69 |
cv2.rectangle(image,(x1,y1),(x2,y2),(0,255,0),2)
|
70 |
cv2.rectangle(image,(x1,y2-35),(x2,y2),(0,255,0),cv2.FILLED)
|
71 |
cv2.putText(image,name,(x1+6,y2-6),cv2.FONT_HERSHEY_COMPLEX,1,(255, 255, 255),2)
|
|
|
72 |
##############
|
73 |
url = "https://kiwi-whispering-plier.glitch.me/update"
|
74 |
|
|
|
3 |
import numpy as np
|
4 |
import cv2
|
5 |
import requests
|
|
|
6 |
import face_recognition
|
7 |
import os
|
8 |
from datetime import datetime
|
|
|
27 |
classnames.append(os.path.splitext(cls)[0])
|
28 |
st.write(classnames)
|
29 |
|
|
|
30 |
def findEncodings(Images):
|
31 |
encodeList = []
|
32 |
for img in Images:
|
|
|
35 |
encodeList.append(encode)
|
36 |
return encodeList
|
37 |
|
|
|
38 |
encodeListknown = findEncodings(Images)
|
39 |
st.write('Encoding Complete')
|
40 |
|
|
|
59 |
matchIndex = np.argmin(faceDis)
|
60 |
|
61 |
if matches[matchIndex]:
|
62 |
+
name = classnames[matchIndex]
|
63 |
st.write(name)
|
64 |
y1, x2, y2, x1 = faceLoc
|
65 |
y1, x2, y2, x1 = y1*4,x2*4,y2*4,x1*4
|
66 |
cv2.rectangle(image,(x1,y1),(x2,y2),(0,255,0),2)
|
67 |
cv2.rectangle(image,(x1,y2-35),(x2,y2),(0,255,0),cv2.FILLED)
|
68 |
cv2.putText(image,name,(x1+6,y2-6),cv2.FONT_HERSHEY_COMPLEX,1,(255, 255, 255),2)
|
69 |
+
|
70 |
##############
|
71 |
url = "https://kiwi-whispering-plier.glitch.me/update"
|
72 |
|