awacke1 commited on
Commit
adf1925
โ€ข
1 Parent(s): 9dac053

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
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.choice(images)
21
- image2 = random.choice(images)
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