Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -229,13 +229,19 @@ def main():
|
|
| 229 |
|
| 230 |
|
| 231 |
if st.sidebar.button("🗑 Delete All"):
|
| 232 |
-
#
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
for
|
| 238 |
-
os.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 239 |
st.experimental_rerun()
|
| 240 |
|
| 241 |
if st.sidebar.button("⬇️ Download All"):
|
|
|
|
| 229 |
|
| 230 |
|
| 231 |
if st.sidebar.button("🗑 Delete All"):
|
| 232 |
+
# Clear history file
|
| 233 |
+
with open("history.json", "w") as f:
|
| 234 |
+
json.dump({}, f)
|
| 235 |
+
|
| 236 |
+
# Delete all files in subdirectories
|
| 237 |
+
for subdir in glob.glob('*'):
|
| 238 |
+
if os.path.isdir(subdir) and subdir not in EXCLUDED_FILES:
|
| 239 |
+
for file in os.listdir(subdir):
|
| 240 |
+
file_path = os.path.join(subdir, file)
|
| 241 |
+
os.remove(file_path)
|
| 242 |
+
st.write(f"Deleted: {file_path}")
|
| 243 |
+
os.rmdir(subdir) # Remove the empty directory
|
| 244 |
+
|
| 245 |
st.experimental_rerun()
|
| 246 |
|
| 247 |
if st.sidebar.button("⬇️ Download All"):
|