Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -22,12 +22,12 @@ def display_images(image_dir):
|
|
22 |
|
23 |
with col1:
|
24 |
st.image(os.path.join(image_dir, image1))
|
25 |
-
if st.button(f"Upvote {image1}"):
|
26 |
handle_vote(image1)
|
27 |
|
28 |
with col2:
|
29 |
st.image(os.path.join(image_dir, image2))
|
30 |
-
if st.button(f"Upvote {image2}"):
|
31 |
handle_vote(image2)
|
32 |
|
33 |
# π― 2. Handle the voting logic and store the history
|
|
|
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
|
26 |
handle_vote(image1)
|
27 |
|
28 |
with col2:
|
29 |
st.image(os.path.join(image_dir, image2))
|
30 |
+
if st.button(f"Upvote {image2}", key=f"upvote_{image2}"): # Use image filename as key
|
31 |
handle_vote(image2)
|
32 |
|
33 |
# π― 2. Handle the voting logic and store the history
|