testcolab2 commited on
Commit
a60407d
·
verified ·
1 Parent(s): 39f86fb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -9
app.py CHANGED
@@ -123,7 +123,7 @@ def main():
123
  st.set_page_config(page_title="Chat with multiple PDFs", page_icon="logo1.png")
124
  st.write(css, unsafe_allow_html=True)
125
 
126
- if "conversation" not in st.session_state or st.session_state.conversation is None:
127
  st.session_state.conversation = None
128
 
129
  if "chat_history" not in st.session_state:
@@ -147,17 +147,12 @@ def main():
147
  # Get the text chunks
148
  text_chunks = get_text_chunks(raw_text)
149
 
150
- # Clear chat history
151
- st.session_state.chat_history = None
152
 
153
  # Initialize conversation chain
154
- st.session_state.conversation = initialize_conversation_chain(text_chunks)
 
155
 
156
- if st.session_state.conversation is not None:
157
- if st.session_state.chat_history is None:
158
- # Greet the user
159
- greeting = "Hello! How can I assist you with your documents?"
160
- st.write(bot_template.replace("{{MSG}}", greeting), unsafe_allow_html=True)
161
 
162
  if __name__ == '__main__':
163
  main()
 
123
  st.set_page_config(page_title="Chat with multiple PDFs", page_icon="logo1.png")
124
  st.write(css, unsafe_allow_html=True)
125
 
126
+ if "conversation" not in st.session_state:
127
  st.session_state.conversation = None
128
 
129
  if "chat_history" not in st.session_state:
 
147
  # Get the text chunks
148
  text_chunks = get_text_chunks(raw_text)
149
 
150
+ vectorstore = get_vectorstore(text_chunks)
 
151
 
152
  # Initialize conversation chain
153
+ st.session_state.conversation = get_conversation_chain(vectorstore)
154
+
155
 
 
 
 
 
 
156
 
157
  if __name__ == '__main__':
158
  main()