Update app.py
Browse files
app.py
CHANGED
@@ -340,34 +340,25 @@ with tab2:
|
|
340 |
# Tab 3: User Input and Results
|
341 |
with tab3:
|
342 |
|
343 |
-
|
344 |
-
if 'image_paths' in st.session_state:
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
if idx < len(st.session_state['image_paths']):
|
352 |
-
with cols[j]:
|
353 |
-
st.image(st.session_state['image_paths'][idx], use_column_width=True)
|
354 |
-
if st.button(f"Details {idx}", key=f"button_{idx}"):
|
355 |
-
st.write(f"You clicked on image {idx}")
|
356 |
|
357 |
-
|
358 |
-
|
359 |
-
# Create a slider
|
360 |
-
image_idx = st.slider("Select an Image", 0, len(st.session_state['image_paths']) - 1, 0)
|
361 |
-
# Display the selected image
|
362 |
-
st.image(st.session_state['image_paths'][image_idx], use_column_width=True)
|
363 |
-
# Optional: Add a details button for the selected image
|
364 |
-
if st.button(f"Details for Image {image_idx}", key=f"button_details_{image_idx}"):
|
365 |
-
st.write(f"You clicked on image {image_idx}")
|
366 |
|
|
|
|
|
|
|
|
|
367 |
|
368 |
|
369 |
-
'''
|
370 |
-
|
371 |
if 'image_paths' in st.session_state:
|
372 |
for i in range(0, len(st.session_state['image_paths']), 4):
|
373 |
cols = st.columns(4)
|
@@ -379,4 +370,5 @@ with tab3:
|
|
379 |
if st.button(f"Details {idx}", key=f"button_{idx}"):
|
380 |
st.write(f"You clicked on image {idx}")
|
381 |
# Add more actions for the click event here
|
382 |
-
|
|
|
|
340 |
# Tab 3: User Input and Results
|
341 |
with tab3:
|
342 |
|
343 |
+
|
344 |
+
if 'image_paths' in st.session_state and st.session_state['image_paths']:
|
345 |
+
# Create a slider for image selection
|
346 |
+
image_index = st.select_slider(
|
347 |
+
"Choose an image",
|
348 |
+
options=list(range(len(st.session_state['image_paths']))),
|
349 |
+
format_func=lambda x: f"Image {x + 1}"
|
350 |
+
)
|
|
|
|
|
|
|
|
|
|
|
351 |
|
352 |
+
# Display the selected image
|
353 |
+
st.image(st.session_state['image_paths'][image_index], use_column_width=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
354 |
|
355 |
+
# Button for actions related to the selected image
|
356 |
+
if st.button("Details", key=f"details_{image_index}"):
|
357 |
+
st.write(f"You clicked on image {image_index + 1}")
|
358 |
+
# Add more actions for the click event here
|
359 |
|
360 |
|
361 |
+
'''
|
|
|
362 |
if 'image_paths' in st.session_state:
|
363 |
for i in range(0, len(st.session_state['image_paths']), 4):
|
364 |
cols = st.columns(4)
|
|
|
370 |
if st.button(f"Details {idx}", key=f"button_{idx}"):
|
371 |
st.write(f"You clicked on image {idx}")
|
372 |
# Add more actions for the click event here
|
373 |
+
|
374 |
+
'''
|