awacke1 commited on
Commit
df9740e
Β·
1 Parent(s): 615dcba

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
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 = sorted(all_files, key=lambda x: (os.path.splitext(x)[1], x)) # sort by file type and file name
 
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()