Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -18,17 +18,29 @@ Images = []
|
|
18 |
classnames = []
|
19 |
|
20 |
# read images and train the face_recognition package
|
21 |
-
img1 = cv2.imread(p1)
|
22 |
-
Images.append(img1)
|
23 |
-
classnames.append("Sarwan")
|
24 |
|
25 |
-
img2 = cv2.imread(p2)
|
26 |
-
Images.append(img2)
|
27 |
-
classnames.append("RattanTata")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
-
img3 = cv2.imread(p3)
|
30 |
-
Images.append(img3)
|
31 |
-
classnames.append("RavinderKaur")
|
32 |
|
33 |
# Load images for face recognition
|
34 |
encodeListknown = [face_recognition.face_encodings(img)[0] for img in Images]
|
|
|
18 |
classnames = []
|
19 |
|
20 |
# read images and train the face_recognition package
|
21 |
+
# img1 = cv2.imread(p1)
|
22 |
+
# Images.append(img1)
|
23 |
+
# classnames.append("Sarwan")
|
24 |
|
25 |
+
# img2 = cv2.imread(p2)
|
26 |
+
# Images.append(img2)
|
27 |
+
# classnames.append("RattanTata")
|
28 |
+
|
29 |
+
# img3 = cv2.imread(p3)
|
30 |
+
# Images.append(img3)
|
31 |
+
# classnames.append("RavinderKaur")
|
32 |
+
|
33 |
+
directory = "facerecognition"
|
34 |
+
myList = os.listdir(directory)
|
35 |
+
|
36 |
+
|
37 |
+
for cls in myList:
|
38 |
+
if os.path.splitext(cls)[1] in [".jpg", ".jpeg",".png"]:
|
39 |
+
img_path = os.path.join(directory, cls)
|
40 |
+
curImg = cv2.imread(img_path)
|
41 |
+
Images.append(curImg)
|
42 |
+
classnames.append(os.path.splitext(cls)[0])
|
43 |
|
|
|
|
|
|
|
44 |
|
45 |
# Load images for face recognition
|
46 |
encodeListknown = [face_recognition.face_encodings(img)[0] for img in Images]
|