Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -201,12 +201,23 @@ def main():
|
|
| 201 |
for subdir in history.values():
|
| 202 |
show_download_links(subdir)
|
| 203 |
|
|
|
|
| 204 |
if st.sidebar.button("🗑 Delete All"):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 205 |
for file in all_files:
|
| 206 |
os.remove(file)
|
| 207 |
st.experimental_rerun()
|
| 208 |
|
| 209 |
if st.sidebar.button("⬇️ Download All"):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 210 |
zip_file = create_zip_of_files(all_files)
|
| 211 |
st.sidebar.markdown(get_zip_download_link(zip_file), unsafe_allow_html=True)
|
| 212 |
file_contents=''
|
|
|
|
| 201 |
for subdir in history.values():
|
| 202 |
show_download_links(subdir)
|
| 203 |
|
| 204 |
+
|
| 205 |
if st.sidebar.button("🗑 Delete All"):
|
| 206 |
+
# Compose all_files
|
| 207 |
+
all_files = glob.glob("*.*")
|
| 208 |
+
all_files = [file for file in all_files if len(os.path.splitext(file)[0]) >= 10] # exclude files with short names
|
| 209 |
+
all_files.sort(key=lambda x: (os.path.splitext(x)[1], x), reverse=True) # sort by file type and file name in descending order
|
| 210 |
+
|
| 211 |
for file in all_files:
|
| 212 |
os.remove(file)
|
| 213 |
st.experimental_rerun()
|
| 214 |
|
| 215 |
if st.sidebar.button("⬇️ Download All"):
|
| 216 |
+
# Compose all_files
|
| 217 |
+
all_files = glob.glob("*.*")
|
| 218 |
+
all_files = [file for file in all_files if len(os.path.splitext(file)[0]) >= 10] # exclude files with short names
|
| 219 |
+
all_files.sort(key=lambda x: (os.path.splitext(x)[1], x), reverse=True) # sort by file type and file name in descending order
|
| 220 |
+
|
| 221 |
zip_file = create_zip_of_files(all_files)
|
| 222 |
st.sidebar.markdown(get_zip_download_link(zip_file), unsafe_allow_html=True)
|
| 223 |
file_contents=''
|