Spaces:
Running
Running
phyloforfun
commited on
Commit
·
6dbe10f
1
Parent(s):
70865fd
file upload gallery
Browse files
app.py
CHANGED
@@ -608,22 +608,23 @@ def display_image_gallery():
|
|
608 |
"""
|
609 |
|
610 |
# Loop through each image in the input list
|
611 |
-
with con_image.container():
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
|
|
627 |
|
628 |
|
629 |
# Close the div for the image grid
|
|
|
608 |
"""
|
609 |
|
610 |
# Loop through each image in the input list
|
611 |
+
# with con_image.container():
|
612 |
+
for image_path in st.session_state['input_list']:
|
613 |
+
# Open the image and create a thumbnail
|
614 |
+
img = Image.open(image_path)
|
615 |
+
img.thumbnail((120, 120), Image.Resampling.LANCZOS)
|
616 |
+
|
617 |
+
# Convert the image to base64
|
618 |
+
base64_image = image_to_base64(img)
|
619 |
+
|
620 |
+
# Append the image to the grid HTML
|
621 |
+
img_html = f"""
|
622 |
+
<div style='display: flex; flex-wrap: wrap; overflow-y: auto; max-height: 400px;'>
|
623 |
+
<img src='data:image/jpeg;base64,{base64_image}' alt='Image' style='max-width: 100%; height: auto;'>
|
624 |
+
</div>
|
625 |
+
"""
|
626 |
+
img_grid_html += img_html
|
627 |
+
# st.markdown(img_html, unsafe_allow_html=True)
|
628 |
|
629 |
|
630 |
# Close the div for the image grid
|