awacke1 commited on
Commit
ef12c00
·
1 Parent(s): c111cec

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -23,7 +23,7 @@ def chat_with_model(prompts):
23
  def generate_filename(prompt):
24
  safe_date_time = datetime.now().strftime("%Y_%m_%d_%H_%M_%S")
25
  safe_prompt = "".join(x for x in prompt if x.isalnum())[:50]
26
- return f"{safe_date_time}_{safe_prompt}.txt"
27
 
28
  def create_file(filename, prompt, response):
29
  with open(filename, 'w') as file:
@@ -33,7 +33,7 @@ def get_table_download_link(file_path):
33
  with open(file_path, 'r') as file:
34
  data = file.read()
35
  b64 = base64.b64encode(data.encode()).decode()
36
- href = f'<a href="data:file/txt;base64,{b64}" download="{os.path.basename(file_path)}">{os.path.basename(file_path)}</a>'
37
  return href
38
 
39
  def main():
@@ -59,7 +59,7 @@ def main():
59
 
60
  st.markdown(get_table_download_link(filename), unsafe_allow_html=True)
61
 
62
- htm_files = glob.glob("*.txt")
63
  for file in htm_files:
64
  st.markdown(get_table_download_link(file), unsafe_allow_html=True)
65
 
 
23
  def generate_filename(prompt):
24
  safe_date_time = datetime.now().strftime("%Y_%m_%d_%H_%M_%S")
25
  safe_prompt = "".join(x for x in prompt if x.isalnum())[:50]
26
+ return f"{safe_date_time}_{safe_prompt}.htm"
27
 
28
  def create_file(filename, prompt, response):
29
  with open(filename, 'w') as file:
 
33
  with open(file_path, 'r') as file:
34
  data = file.read()
35
  b64 = base64.b64encode(data.encode()).decode()
36
+ href = f'<a href="data:file/htm;base64,{b64}" download="{os.path.basename(file_path)}">{os.path.basename(file_path)}</a>'
37
  return href
38
 
39
  def main():
 
59
 
60
  st.markdown(get_table_download_link(filename), unsafe_allow_html=True)
61
 
62
+ htm_files = glob.glob("*.htm")
63
  for file in htm_files:
64
  st.markdown(get_table_download_link(file), unsafe_allow_html=True)
65