Shreyas094 commited on
Commit
6a8b63b
·
verified ·
1 Parent(s): 7b3e103

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -342,9 +342,11 @@ def ask_question(question, temperature, top_p, repetition_penalty, web_search):
342
 
343
  answer = generate_chunked_response(model, formatted_prompt)
344
  else:
345
- if database is None:
346
  return "No documents available. Please upload documents or enable web search to answer questions."
347
 
 
 
348
  history_str = "\n".join([f"Q: {item['question']}\nA: {item['answer']}" for item in conversation_history])
349
 
350
  if is_related_to_history(question, conversation_history):
 
342
 
343
  answer = generate_chunked_response(model, formatted_prompt)
344
  else:
345
+ if not os.path.exists("faiss_database"):
346
  return "No documents available. Please upload documents or enable web search to answer questions."
347
 
348
+ database = FAISS.load_local("faiss_database", embed, allow_dangerous_deserialization=True)
349
+
350
  history_str = "\n".join([f"Q: {item['question']}\nA: {item['answer']}" for item in conversation_history])
351
 
352
  if is_related_to_history(question, conversation_history):