eaglelandsonce commited on
Commit
531a7b6
·
verified ·
1 Parent(s): aeee856

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -1
app.py CHANGED
@@ -339,6 +339,35 @@ with tab2:
339
 
340
  # Tab 3: User Input and Results
341
  with tab3:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
342
  if 'image_paths' in st.session_state:
343
  for i in range(0, len(st.session_state['image_paths']), 4):
344
  cols = st.columns(4)
@@ -349,4 +378,5 @@ with tab3:
349
  st.image(st.session_state['image_paths'][idx], use_column_width=True)
350
  if st.button(f"Details {idx}", key=f"button_{idx}"):
351
  st.write(f"You clicked on image {idx}")
352
- # Add more actions for the click event here
 
 
339
 
340
  # Tab 3: User Input and Results
341
  with tab3:
342
+
343
+ # Check if 'image_paths' is in session state
344
+ if 'image_paths' in st.session_state:
345
+ # Grid Layout Section
346
+ st.header("Image Grid Layout")
347
+ for i in range(0, len(st.session_state['image_paths']), 4):
348
+ cols = st.columns(4)
349
+ for j in range(4):
350
+ idx = i + j
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
+ # Slider-Based Single Image View Section
358
+ st.header("Slider-Based Image Viewer")
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)
 
378
  st.image(st.session_state['image_paths'][idx], use_column_width=True)
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
+ '''