Spaces:
Sleeping
Sleeping
LovnishVerma
commited on
Commit
•
08d06ea
1
Parent(s):
f57d510
Update app.py
Browse files
app.py
CHANGED
@@ -58,10 +58,14 @@ if file_name is not None:
|
|
58 |
|
59 |
y1, x2, y2, x1 = faceLoc
|
60 |
y1, x2, y2, x1 = (y1 * 4), (x2 * 4), (y2 * 4) ,(x1 * 4)
|
61 |
-
cv2.rectangle(image , (x1, y1), (x2, y2), (0, 255, 0), 2)
|
62 |
-
cv2.rectangle(image , (x1, y2 - 35), (x2, y2), (0, 255, 0), cv2.FILLED)
|
63 |
-
cv2.putText(image , name, (x1 + 6, y2 - 6), cv2.FONT_HERSHEY_COMPLEX, 1, (255, 255, 255), 2)
|
64 |
|
65 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
else:
|
67 |
st.warning("No faces detected in the image. Face recognition failed.")
|
|
|
58 |
|
59 |
y1, x2, y2, x1 = faceLoc
|
60 |
y1, x2, y2, x1 = (y1 * 4), (x2 * 4), (y2 * 4) ,(x1 * 4)
|
|
|
|
|
|
|
61 |
|
62 |
+
# Make a copy of the image array before drawing on it
|
63 |
+
image_copy = image.copy()
|
64 |
+
|
65 |
+
cv2.rectangle(image_copy, (x1, y1), (x2, y2), (0, 255, 0), 2)
|
66 |
+
cv2.rectangle(image_copy, (x1, y2 - 35), (x2, y2), (0, 255, 0), cv2.FILLED)
|
67 |
+
cv2.putText(image_copy, name, (x1 + 6, y2 - 6), cv2.FONT_HERSHEY_COMPLEX, 1, (255, 255, 255), 2)
|
68 |
+
|
69 |
+
st.image(image_copy, use_column_width=True, output_format="PNG")
|
70 |
else:
|
71 |
st.warning("No faces detected in the image. Face recognition failed.")
|