shukdevdatta123 commited on
Commit
a1e3625
·
verified ·
1 Parent(s): 18abc66

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -2
app.py CHANGED
@@ -5,7 +5,7 @@ from helpers import text_to_speech, autoplay_audio, speech_to_text, get_api_key
5
  from generate_answer import base_model_chatbot, with_pdf_chatbot
6
  from audio_recorder_streamlit import audio_recorder
7
  from streamlit_float import *
8
-
9
  def main(answer_mode: str):
10
  # Float feature initialization
11
  float_init()
@@ -66,5 +66,17 @@ def main(answer_mode: str):
66
  # Float the footer container and provide CSS to target it with
67
  footer_container.float("bottom: 0rem;")
68
 
 
 
 
 
 
 
 
 
 
 
 
 
69
  if __name__ == "__main__":
70
- main(answer_mode='base_model') # Or: answer_mode='base_model'
 
5
  from generate_answer import base_model_chatbot, with_pdf_chatbot
6
  from audio_recorder_streamlit import audio_recorder
7
  from streamlit_float import *
8
+ import io
9
  def main(answer_mode: str):
10
  # Float feature initialization
11
  float_init()
 
66
  # Float the footer container and provide CSS to target it with
67
  footer_container.float("bottom: 0rem;")
68
 
69
+ # --- Download Button ---
70
+ conversation_text = "\n".join(
71
+ f"{msg['role'].capitalize()}: {msg['content']}" for msg in st.session_state.messages
72
+ )
73
+ conversation_bytes = io.BytesIO(conversation_text.encode("utf-8"))
74
+ st.download_button(
75
+ label="Download Conversation",
76
+ data=conversation_bytes,
77
+ file_name="conversation.txt",
78
+ mime="text/plain",
79
+ )
80
+
81
  if __name__ == "__main__":
82
+ main(answer_mode='base_model')