awacke1 commited on
Commit
9b0e1aa
·
1 Parent(s): 9d23136

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -44,7 +44,7 @@ def chat_with_model(prompt, document_section):
44
  def generate_filename(prompt, file_type):
45
  central = pytz.timezone('US/Central')
46
  safe_date_time = datetime.now(central).strftime("%m%d_%I%M")
47
- safe_prompt = "".join(x for x in prompt if x.isalnum())[:28]
48
  return f"{safe_date_time}_{safe_prompt}.{file_type}"
49
 
50
  def create_file(filename, prompt, response):
@@ -157,8 +157,9 @@ 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 = sorted(all_files, key=lambda x: (os.path.splitext(x)[1], x)) # sort by file type and file name
163
  for file in all_files:
164
  col1, col3 = st.sidebar.columns([5,1]) # adjust the ratio as needed
 
44
  def generate_filename(prompt, file_type):
45
  central = pytz.timezone('US/Central')
46
  safe_date_time = datetime.now(central).strftime("%m%d_%I%M")
47
+ safe_prompt = "".join(x for x in prompt if x.isalnum())[:36]
48
  return f"{safe_date_time}_{safe_prompt}.{file_type}"
49
 
50
  def create_file(filename, prompt, response):
 
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