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