Update app.py
Browse files
app.py
CHANGED
|
@@ -126,22 +126,24 @@ def main():
|
|
| 126 |
start_index = (tabs - 1) * images_per_page
|
| 127 |
end_index = min(start_index + images_per_page, length)
|
| 128 |
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
|
|
|
|
|
|
| 145 |
|
| 146 |
|
| 147 |
if __name__ == '__main__':
|
|
|
|
| 126 |
start_index = (tabs - 1) * images_per_page
|
| 127 |
end_index = min(start_index + images_per_page, length)
|
| 128 |
|
| 129 |
+
for img_id in similar_images:
|
| 130 |
+
row = df[df['seller_img_id'] == img_id]
|
| 131 |
+
if not row.empty:
|
| 132 |
+
img_path = row['img_path'].values[0]
|
| 133 |
+
product_id = row['product_id'].values[0]
|
| 134 |
+
|
| 135 |
+
# Construct the full path to the image
|
| 136 |
+
full_img_path = img_path
|
| 137 |
+
|
| 138 |
+
# Open and resize the image to the desired dimensions
|
| 139 |
+
image = read_image(full_img_path)
|
| 140 |
+
resized_image = cv2.resize(image, (image_width, image_height))
|
| 141 |
+
|
| 142 |
+
# Determine the column to place the image in
|
| 143 |
+
col_index = index % num_columns
|
| 144 |
+
st.image(resized_image, caption=f'Product ID: {product_id}\nImage ID: {img_id}', width=image_width)
|
| 145 |
+
else:
|
| 146 |
+
st.write(f"Could not find details for image with ID: {img_id}")
|
| 147 |
|
| 148 |
|
| 149 |
if __name__ == '__main__':
|