Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -5,7 +5,7 @@ import random
|
|
5 |
# ๐ผ๏ธ 1. Display two columns, each with a random image from the current directory
|
6 |
def display_images(image_dir):
|
7 |
"""๐ผ๏ธ Function 1: Displays two random images side by side for voting, filtered to only show image files."""
|
8 |
-
|
9 |
col1, col2 = st.columns(2)
|
10 |
|
11 |
# ๐๏ธ Load and filter only image files from the directory
|
@@ -16,10 +16,9 @@ def display_images(image_dir):
|
|
16 |
st.error("Not enough images in the directory.")
|
17 |
return
|
18 |
|
19 |
-
# ๐ธ Randomly select two images
|
20 |
-
image1 = random.
|
21 |
-
|
22 |
-
|
23 |
with col1:
|
24 |
st.image(os.path.join(image_dir, image1))
|
25 |
if st.button(f"Upvote {image1}", key=f"upvote_{image1}"): # Use image filename as key
|
|
|
5 |
# ๐ผ๏ธ 1. Display two columns, each with a random image from the current directory
|
6 |
def display_images(image_dir):
|
7 |
"""๐ผ๏ธ Function 1: Displays two random images side by side for voting, filtered to only show image files."""
|
8 |
+
|
9 |
col1, col2 = st.columns(2)
|
10 |
|
11 |
# ๐๏ธ Load and filter only image files from the directory
|
|
|
16 |
st.error("Not enough images in the directory.")
|
17 |
return
|
18 |
|
19 |
+
# ๐ธ Randomly select two *unique* images
|
20 |
+
image1, image2 = random.sample(images, 2)
|
21 |
+
|
|
|
22 |
with col1:
|
23 |
st.image(os.path.join(image_dir, image1))
|
24 |
if st.button(f"Upvote {image1}", key=f"upvote_{image1}"): # Use image filename as key
|