shubhendu-ghosh commited on
Commit
2ec3bd5
1 Parent(s): 0e30719

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -4,7 +4,7 @@ from langchain.text_splitter import RecursiveCharacterTextSplitter
4
  import os
5
  from langchain_google_genai import GoogleGenerativeAIEmbeddings
6
  import google.generativeai as genai
7
- from langchain.vectorstores import FAISS
8
  from langchain_google_genai import ChatGoogleGenerativeAI
9
  from langchain.chains.question_answering import load_qa_chain
10
  from langchain.prompts import PromptTemplate
@@ -89,7 +89,7 @@ def get_conversational_chain():
89
  def user_input(user_question):
90
  embeddings = GoogleGenerativeAIEmbeddings(model = "models/embedding-001")
91
  try:
92
- new_db = FAISS.load_local("faiss_index", embeddings)
93
  docs = new_db.similarity_search(user_question)
94
  except Exception as e:
95
  st.markdown(f"""<p style="color: #e80000;font-size: 15px;font-family: sans-serif; text-align:left;margin-bottom: 0px; height: 5px">Document not submitted. Please upload a pdf and then click on 'submit'. Only then we can answer your question</p>""", unsafe_allow_html=True)
 
4
  import os
5
  from langchain_google_genai import GoogleGenerativeAIEmbeddings
6
  import google.generativeai as genai
7
+ from langchain_community.vectorstores import FAISS
8
  from langchain_google_genai import ChatGoogleGenerativeAI
9
  from langchain.chains.question_answering import load_qa_chain
10
  from langchain.prompts import PromptTemplate
 
89
  def user_input(user_question):
90
  embeddings = GoogleGenerativeAIEmbeddings(model = "models/embedding-001")
91
  try:
92
+ new_db = FAISS.load_local("faiss_index", embeddings, allow_dangerous_deserialization=True)
93
  docs = new_db.similarity_search(user_question)
94
  except Exception as e:
95
  st.markdown(f"""<p style="color: #e80000;font-size: 15px;font-family: sans-serif; text-align:left;margin-bottom: 0px; height: 5px">Document not submitted. Please upload a pdf and then click on 'submit'. Only then we can answer your question</p>""", unsafe_allow_html=True)