Spaces:
Runtime error
Runtime error
bug fiexd
Browse files
pages/2_Face Detection and Creating Database.py
CHANGED
|
@@ -124,16 +124,22 @@ def step2_page():
|
|
| 124 |
pil_image.save(img_path)
|
| 125 |
st.success("Face added successfully!")
|
| 126 |
|
| 127 |
-
|
|
|
|
| 128 |
images = os.listdir(img_dir)
|
| 129 |
if len(images) <= 0:
|
| 130 |
-
st.
|
| 131 |
else:
|
| 132 |
cols = st.columns(len(images))
|
| 133 |
-
for i
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 137 |
|
| 138 |
if st.button("Clear All"):
|
| 139 |
for img in images:
|
|
|
|
| 124 |
pil_image.save(img_path)
|
| 125 |
st.success("Face added successfully!")
|
| 126 |
|
| 127 |
+
|
| 128 |
+
st.info("Now lets see your known-faces database!")
|
| 129 |
images = os.listdir(img_dir)
|
| 130 |
if len(images) <= 0:
|
| 131 |
+
st.write("No faces have been added yet.")
|
| 132 |
else:
|
| 133 |
cols = st.columns(len(images))
|
| 134 |
+
for i in range(len(images)):
|
| 135 |
+
col = cols[i]
|
| 136 |
+
|
| 137 |
+
# display faces
|
| 138 |
+
with col:
|
| 139 |
+
face = face_recognition.load_image_file(images[i])
|
| 140 |
+
face_name = images[i].split("_")[1]
|
| 141 |
+
st.image(face, use_column_width="auto")
|
| 142 |
+
st.write(face_name)
|
| 143 |
|
| 144 |
if st.button("Clear All"):
|
| 145 |
for img in images:
|