Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -157,10 +157,11 @@ def main():
|
|
157 |
filename = generate_filename(user_prompt, choice)
|
158 |
create_file(filename, user_prompt, response)
|
159 |
st.sidebar.markdown(get_table_download_link(filename), unsafe_allow_html=True)
|
160 |
-
|
161 |
all_files = glob.glob("*.*")
|
162 |
all_files = [file for file in all_files if len(os.path.splitext(file)[0]) >= 20] # exclude files with short names
|
163 |
-
all_files
|
|
|
164 |
for file in all_files:
|
165 |
col1, col3 = st.sidebar.columns([5,1]) # adjust the ratio as needed
|
166 |
with col1:
|
@@ -169,6 +170,6 @@ def main():
|
|
169 |
if st.button("π", key="delete_"+file):
|
170 |
os.remove(file)
|
171 |
st.experimental_rerun()
|
172 |
-
|
173 |
if __name__ == "__main__":
|
174 |
main()
|
|
|
157 |
filename = generate_filename(user_prompt, choice)
|
158 |
create_file(filename, user_prompt, response)
|
159 |
st.sidebar.markdown(get_table_download_link(filename), unsafe_allow_html=True)
|
160 |
+
|
161 |
all_files = glob.glob("*.*")
|
162 |
all_files = [file for file in all_files if len(os.path.splitext(file)[0]) >= 20] # exclude files with short names
|
163 |
+
all_files.sort(key=lambda x: (os.path.splitext(x)[1], x), reverse=True) # sort by file type and file name in descending order
|
164 |
+
|
165 |
for file in all_files:
|
166 |
col1, col3 = st.sidebar.columns([5,1]) # adjust the ratio as needed
|
167 |
with col1:
|
|
|
170 |
if st.button("π", key="delete_"+file):
|
171 |
os.remove(file)
|
172 |
st.experimental_rerun()
|
173 |
+
|
174 |
if __name__ == "__main__":
|
175 |
main()
|