Spaces:
Sleeping
Sleeping
Updated app.py
Browse files
app.py
CHANGED
|
@@ -66,9 +66,13 @@ if file is not None:
|
|
| 66 |
for i, idx in enumerate(indices[0]):
|
| 67 |
product_path = filenames[idx]
|
| 68 |
product_path = product_path.replace('\\', '/')
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
for i, idx in enumerate(indices[0]):
|
| 67 |
product_path = filenames[idx]
|
| 68 |
product_path = product_path.replace('\\', '/')
|
| 69 |
+
|
| 70 |
+
# Check if the image exists before displaying
|
| 71 |
+
if os.path.exists(product_path):
|
| 72 |
+
product_image = Image.open(product_path)
|
| 73 |
+
# Assign columns dynamically
|
| 74 |
+
with cols[i % 3]:
|
| 75 |
+
st.image(product_image, caption=f"Product {i + 1}")
|
| 76 |
+
else:
|
| 77 |
+
# If the image does not exist, skip it
|
| 78 |
+
st.write(f"Image for Product {i + 1} not found.")
|