awacke1 commited on
Commit
afd67ae
β€’
1 Parent(s): 7e684c4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -7
app.py CHANGED
@@ -21,8 +21,7 @@ def chat_with_model(prompts):
21
  return response['choices'][0]['message']['content']
22
 
23
  def generate_filename(prompt):
24
- # safe_date_time = datetime.now().strftime("%Y_%m_%d_%H_%M_%S")
25
- safe_date_time = datetime.now().strftime("%m_%d_%H_%M") # short date format
26
 
27
  safe_prompt = "".join(x for x in prompt if x.isalnum())[:50]
28
  return f"{safe_date_time}_{safe_prompt}.htm"
@@ -41,12 +40,8 @@ def get_table_download_link(file_path):
41
  def main():
42
  st.title("Chat with AI")
43
 
44
- # Pre-defined prompts
45
- # prompts = ['Hows the weather?', 'Tell me a joke.', 'What is the meaning of life?']
46
  prompts = ['']
47
 
48
- # User prompt input
49
- # user_prompt = st.text_input("Your question:", '')
50
  user_prompt = st.text_area("Your question:", '', height=120)
51
 
52
  if user_prompt:
@@ -68,7 +63,6 @@ def main():
68
  st.sidebar.markdown(get_table_download_link(file), unsafe_allow_html=True)
69
  if st.sidebar.button(f"Delete {file}"):
70
  os.remove(file)
71
- # Reload page after deletion to refresh the file list
72
  st.experimental_rerun()
73
 
74
  if __name__ == "__main__":
 
21
  return response['choices'][0]['message']['content']
22
 
23
  def generate_filename(prompt):
24
+ safe_date_time = datetime.now().strftime("%m_%d_%H_%M")
 
25
 
26
  safe_prompt = "".join(x for x in prompt if x.isalnum())[:50]
27
  return f"{safe_date_time}_{safe_prompt}.htm"
 
40
  def main():
41
  st.title("Chat with AI")
42
 
 
 
43
  prompts = ['']
44
 
 
 
45
  user_prompt = st.text_area("Your question:", '', height=120)
46
 
47
  if user_prompt:
 
63
  st.sidebar.markdown(get_table_download_link(file), unsafe_allow_html=True)
64
  if st.sidebar.button(f"Delete {file}"):
65
  os.remove(file)
 
66
  st.experimental_rerun()
67
 
68
  if __name__ == "__main__":