ZarinT commited on
Commit
28ed593
·
verified ·
1 Parent(s): 8864f7b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -95,7 +95,7 @@ def preload_modtran_document():
95
  text_chunks = get_text_chunks(raw_text)
96
  vectorstore = get_vectorstore(text_chunks)
97
  set_global_vectorstore(vectorstore)
98
- st.session_state.agent = initialize_chatbot_agent()
99
 
100
  def convert_pdf_to_xml(pdf_file, xml_path):
101
  os.makedirs("temp", exist_ok=True)
@@ -251,6 +251,7 @@ def handle_user_query(query):
251
  else:
252
  context = faiss_search_with_keywords(query)
253
  return self_reasoning(query, context)
 
254
  def main():
255
  load_environment()
256
 
@@ -273,7 +274,8 @@ def main():
273
  user_question = st.text_input("Ask your question:")
274
 
275
  if st.session_state.agent and user_question:
276
- response = handle_user_query(user_question, st.session_state.agent)
 
277
  st.session_state.chat_history.append({"user": user_question, "bot": response})
278
 
279
  for chat in st.session_state.chat_history:
 
95
  text_chunks = get_text_chunks(raw_text)
96
  vectorstore = get_vectorstore(text_chunks)
97
  set_global_vectorstore(vectorstore)
98
+ st.session_state.chat_ready = True
99
 
100
  def convert_pdf_to_xml(pdf_file, xml_path):
101
  os.makedirs("temp", exist_ok=True)
 
251
  else:
252
  context = faiss_search_with_keywords(query)
253
  return self_reasoning(query, context)
254
+
255
  def main():
256
  load_environment()
257
 
 
274
  user_question = st.text_input("Ask your question:")
275
 
276
  if st.session_state.agent and user_question:
277
+ set_global_vectorstore(st.session_state.vectorstore)
278
+ response = handle_user_query(user_question)
279
  st.session_state.chat_history.append({"user": user_question, "bot": response})
280
 
281
  for chat in st.session_state.chat_history: