Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -4,26 +4,37 @@ import cv2
|
|
4 |
import face_recognition
|
5 |
import streamlit as st
|
6 |
|
7 |
-
p1 = "raavi.jpg"
|
8 |
-
p2 = "jivan.jpeg"
|
9 |
-
p3 = "sejal.jpeg"
|
10 |
|
11 |
st.title("Face Recognition")
|
12 |
Images = []
|
13 |
classnames = []
|
14 |
|
15 |
# Read images and train the face_recognition package
|
16 |
-
img1 = cv2.imread(p1)
|
17 |
-
Images.append(img1)
|
18 |
-
classnames.append("Ravi")
|
19 |
|
20 |
-
img2 = cv2.imread(p2)
|
21 |
-
Images.append(img2)
|
22 |
-
classnames.append("Sirwan sir")
|
23 |
|
24 |
-
img3 = cv2.imread(p3)
|
25 |
-
Images.append(img3)
|
26 |
-
classnames.append("sejal")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
# Load images for face recognition
|
29 |
encodeListknown = [face_recognition.face_encodings(img)[0] for img in Images]
|
|
|
4 |
import face_recognition
|
5 |
import streamlit as st
|
6 |
|
7 |
+
#p1 = "raavi.jpg"
|
8 |
+
#p2 = "jivan.jpeg"
|
9 |
+
# p3 = "sejal.jpeg"
|
10 |
|
11 |
st.title("Face Recognition")
|
12 |
Images = []
|
13 |
classnames = []
|
14 |
|
15 |
# Read images and train the face_recognition package
|
16 |
+
# img1 = cv2.imread(p1)
|
17 |
+
# Images.append(img1)
|
18 |
+
# classnames.append("Ravi")
|
19 |
|
20 |
+
# img2 = cv2.imread(p2)
|
21 |
+
# Images.append(img2)
|
22 |
+
# classnames.append("Sirwan sir")
|
23 |
|
24 |
+
# img3 = cv2.imread(p3)
|
25 |
+
# Images.append(img3)
|
26 |
+
# classnames.append("sejal")
|
27 |
+
|
28 |
+
directory = "facerecognition"
|
29 |
+
myList = os.listdir(directory)
|
30 |
+
|
31 |
+
|
32 |
+
for cls in myList:
|
33 |
+
if os.path.splitext(cls)[1] in [".jpg", ".jpeg",".png"]:
|
34 |
+
img_path = os.path.join(directory, cls)
|
35 |
+
curImg = cv2.imread(img_path)
|
36 |
+
Images.append(curImg)
|
37 |
+
classnames.append(os.path.splitext(cls)[0])
|
38 |
|
39 |
# Load images for face recognition
|
40 |
encodeListknown = [face_recognition.face_encodings(img)[0] for img in Images]
|