xtlyxt commited on
Commit
ecd7482
·
verified ·
1 Parent(s): 24c4a97

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -18,13 +18,21 @@ uploaded_images = st.file_uploader("Upload images", type=["jpg", "png"], accept_
18
 
19
  # Display thumbnail images alongside file names and sizes in the sidebar
20
  selected_images = []
 
21
  if uploaded_images:
 
 
 
 
22
  for idx, img in enumerate(uploaded_images):
23
  image = Image.open(img)
24
  checkbox_key = f"{img.name}_checkbox_{idx}" # Unique key for each checkbox
25
  # Display thumbnail image and checkbox in sidebar
26
  st.sidebar.image(image, caption=f"{img.name} {img.size / 1024.0:.1f} KB", width=40)
27
- selected = st.sidebar.checkbox(f"Select {img.name}", value=False, key=checkbox_key)
 
 
 
28
  if selected:
29
  selected_images.append(image)
30
 
 
18
 
19
  # Display thumbnail images alongside file names and sizes in the sidebar
20
  selected_images = []
21
+
22
  if uploaded_images:
23
+
24
+ # Add a "Select All" checkbox in the sidebar
25
+ select_all = st.sidebar.checkbox("Select All", False)
26
+
27
  for idx, img in enumerate(uploaded_images):
28
  image = Image.open(img)
29
  checkbox_key = f"{img.name}_checkbox_{idx}" # Unique key for each checkbox
30
  # Display thumbnail image and checkbox in sidebar
31
  st.sidebar.image(image, caption=f"{img.name} {img.size / 1024.0:.1f} KB", width=40)
32
+ #selected = st.sidebar.checkbox(f"Select {img.name}", value=False, key=checkbox_key)
33
+ # If "Select All" is checked, all individual checkboxes are selected
34
+ selected = st.sidebar.checkbox(f"Select {img.name}", value=select_all, key=checkbox_key)
35
+
36
  if selected:
37
  selected_images.append(image)
38