Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -65,7 +65,7 @@ if file_name is not None:
|
|
65 |
|
66 |
# Initialize name as Unknown
|
67 |
name = "Unknown"
|
68 |
-
|
69 |
# Check if there's a match with known faces
|
70 |
if True in matches:
|
71 |
matchIndex = np.argmin(faceDis)
|
@@ -73,23 +73,15 @@ if file_name is not None:
|
|
73 |
|
74 |
# Append recognized name to the list
|
75 |
recognized_names.append(name)
|
76 |
-
|
77 |
-
# Draw rectangle
|
78 |
y1, x2, y2, x1 = faceLoc
|
79 |
y1, x2, y2, x1 = (y1 * 4), (x2 * 4), (y2 * 4) ,(x1 * 4)
|
|
|
|
|
80 |
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
cv2.rectangle(image_copy, (x1, y1), (x2, y2), (0, 255, 0), 2)
|
85 |
-
cv2.rectangle(image_copy, (x1, y2 - 35), (x2, y2), (0, 255, 0), cv2.FILLED)
|
86 |
-
cv2.putText(image_copy, name, (x1 + 6, y2 - 6), cv2.FONT_HERSHEY_COMPLEX, 1, (255, 255, 255), 2)
|
87 |
-
|
88 |
-
# Update the database
|
89 |
-
add_attendance(name)
|
90 |
-
|
91 |
-
# Display the image with recognized names
|
92 |
-
st.image(image_copy, use_column_width=True, output_format="PNG")
|
93 |
|
94 |
# Display recognized names
|
95 |
st.write("Recognized Names:")
|
|
|
65 |
|
66 |
# Initialize name as Unknown
|
67 |
name = "Unknown"
|
68 |
+
|
69 |
# Check if there's a match with known faces
|
70 |
if True in matches:
|
71 |
matchIndex = np.argmin(faceDis)
|
|
|
73 |
|
74 |
# Append recognized name to the list
|
75 |
recognized_names.append(name)
|
76 |
+
|
77 |
+
# Draw rectangle around the face
|
78 |
y1, x2, y2, x1 = faceLoc
|
79 |
y1, x2, y2, x1 = (y1 * 4), (x2 * 4), (y2 * 4) ,(x1 * 4)
|
80 |
+
cv2.rectangle(image, (x1, y1), (x2, y2), (0, 255, 0), 2)
|
81 |
+
cv2.putText(image, name, (x1 + 6, y2 - 6), cv2.FONT_HERSHEY_COMPLEX, 1, (255, 255, 255), 2)
|
82 |
|
83 |
+
# Display the image with recognized faces
|
84 |
+
st.image(image, use_column_width=True, output_format="PNG")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
|
86 |
# Display recognized names
|
87 |
st.write("Recognized Names:")
|