Spaces:
Runtime error
Runtime error
sarwansingh
commited on
Commit
•
f88ac95
1
Parent(s):
f813809
Update app.py
Browse files
app.py
CHANGED
@@ -16,11 +16,13 @@ classnames = [] # List to store classnames
|
|
16 |
directory = "photos"
|
17 |
myList = os.listdir(directory)
|
18 |
|
|
|
19 |
for cls in myList:
|
20 |
if os.path.splitext(cls)[1] in [".jpg", ".jpeg"]:
|
21 |
img_path = os.path.join(directory, cls)
|
22 |
curImg = cv2.imread(img_path)
|
23 |
Images.append(curImg)
|
|
|
24 |
classnames.append(os.path.splitext(cls)[0])
|
25 |
|
26 |
# Load images for face recognition
|
@@ -56,7 +58,7 @@ if file_name is not None:
|
|
56 |
match_found = True # Set the flag to True
|
57 |
|
58 |
y1, x2, y2, x1 = faceLoc
|
59 |
-
y1, x2, y2, x1 = (y1 * 4)
|
60 |
cv2.rectangle(image, (x1, y1), (x2, y2), (0, 255, 0), 2)
|
61 |
cv2.rectangle(image, (x1, y2 - 35), (x2, y2), (0, 255, 0), cv2.FILLED)
|
62 |
cv2.putText(image, name, (x1 + 6, y2 - 6), cv2.FONT_HERSHEY_COMPLEX, 1, (255, 255, 255), 2)
|
|
|
16 |
directory = "photos"
|
17 |
myList = os.listdir(directory)
|
18 |
|
19 |
+
st.write("Photographs found in folder : ")
|
20 |
for cls in myList:
|
21 |
if os.path.splitext(cls)[1] in [".jpg", ".jpeg"]:
|
22 |
img_path = os.path.join(directory, cls)
|
23 |
curImg = cv2.imread(img_path)
|
24 |
Images.append(curImg)
|
25 |
+
st.write(os.path.splitext(cls)[0])
|
26 |
classnames.append(os.path.splitext(cls)[0])
|
27 |
|
28 |
# Load images for face recognition
|
|
|
58 |
match_found = True # Set the flag to True
|
59 |
|
60 |
y1, x2, y2, x1 = faceLoc
|
61 |
+
y1, x2, y2, x1 = (y1 * 4), (x2 * 4), (y2 * 4)), (x1 * 4)
|
62 |
cv2.rectangle(image, (x1, y1), (x2, y2), (0, 255, 0), 2)
|
63 |
cv2.rectangle(image, (x1, y2 - 35), (x2, y2), (0, 255, 0), cv2.FILLED)
|
64 |
cv2.putText(image, name, (x1 + 6, y2 - 6), cv2.FONT_HERSHEY_COMPLEX, 1, (255, 255, 255), 2)
|