Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -492,16 +492,18 @@ def main():
|
|
| 492 |
all_files = [file for file in all_files if len(os.path.splitext(file)[0]) >= 20] # exclude files with short names
|
| 493 |
all_files.sort(key=lambda x: (os.path.splitext(x)[1], x), reverse=True) # sort by file type and file name in descending order
|
| 494 |
|
| 495 |
-
|
| 496 |
-
|
| 497 |
-
|
| 498 |
-
|
| 499 |
-
st.
|
| 500 |
-
|
| 501 |
-
|
| 502 |
-
|
| 503 |
-
|
| 504 |
-
|
|
|
|
|
|
|
| 505 |
|
| 506 |
# Sidebar of Files Saving History and surfacing files as context of prompts and responses
|
| 507 |
file_contents=''
|
|
|
|
| 492 |
all_files = [file for file in all_files if len(os.path.splitext(file)[0]) >= 20] # exclude files with short names
|
| 493 |
all_files.sort(key=lambda x: (os.path.splitext(x)[1], x), reverse=True) # sort by file type and file name in descending order
|
| 494 |
|
| 495 |
+
|
| 496 |
+
# Sidebar buttons Download All and Delte All
|
| 497 |
+
colDownloadAll, colDeleteAll = st.sidebar.columns([3,3])
|
| 498 |
+
with colDownloadAll:
|
| 499 |
+
if st.sidebar.button("⬇️ Download All"):
|
| 500 |
+
zip_file = create_zip_of_files(all_files)
|
| 501 |
+
st.sidebar.markdown(get_zip_download_link(zip_file), unsafe_allow_html=True)
|
| 502 |
+
with colDeleteAll:
|
| 503 |
+
if st.sidebar.button("🗑 Delete All"):
|
| 504 |
+
for file in all_files:
|
| 505 |
+
os.remove(file)
|
| 506 |
+
st.experimental_rerun()
|
| 507 |
|
| 508 |
# Sidebar of Files Saving History and surfacing files as context of prompts and responses
|
| 509 |
file_contents=''
|