Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -89,14 +89,22 @@ def show_file_operations(file_path, sequence_number):
|
|
| 89 |
os.remove(file_path)
|
| 90 |
st.markdown(f"File deleted!")
|
| 91 |
|
| 92 |
-
|
|
|
|
|
|
|
| 93 |
def show_download_links(subdir):
|
| 94 |
-
|
| 95 |
for file in list_files(subdir):
|
| 96 |
file_path = os.path.join(subdir, file)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
if os.path.isfile(file_path):
|
| 98 |
st.markdown(get_download_link(file_path), unsafe_allow_html=True)
|
| 99 |
-
show_file_operations(file_path)
|
| 100 |
else:
|
| 101 |
st.write(f"File not found: {file}")
|
| 102 |
|
|
|
|
| 89 |
os.remove(file_path)
|
| 90 |
st.markdown(f"File deleted!")
|
| 91 |
|
| 92 |
+
|
| 93 |
+
file_sequence_numbers = {}
|
| 94 |
+
|
| 95 |
def show_download_links(subdir):
|
| 96 |
+
global file_sequence_numbers
|
| 97 |
for file in list_files(subdir):
|
| 98 |
file_path = os.path.join(subdir, file)
|
| 99 |
+
if file_path not in file_sequence_numbers:
|
| 100 |
+
file_sequence_numbers[file_path] = 1
|
| 101 |
+
else:
|
| 102 |
+
file_sequence_numbers[file_path] += 1
|
| 103 |
+
sequence_number = file_sequence_numbers[file_path]
|
| 104 |
+
|
| 105 |
if os.path.isfile(file_path):
|
| 106 |
st.markdown(get_download_link(file_path), unsafe_allow_html=True)
|
| 107 |
+
show_file_operations(file_path, sequence_number)
|
| 108 |
else:
|
| 109 |
st.write(f"File not found: {file}")
|
| 110 |
|