Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -19,14 +19,7 @@ from langchain.chains import RetrievalQA
|
|
19 |
from langchain.prompts import PromptTemplate
|
20 |
from langchain.embeddings.huggingface import HuggingFaceEmbeddings
|
21 |
|
22 |
-
|
23 |
-
loader = PyPDFLoader("test-1.pdf")
|
24 |
-
data = loader.load()
|
25 |
-
# split the documents into chunks
|
26 |
-
text_splitter1 = CharacterTextSplitter(chunk_size=512, chunk_overlap=0,separator="\n\n")
|
27 |
-
texts = text_splitter1.split_documents(data)
|
28 |
-
db = FAISS.from_documents(texts,
|
29 |
-
HuggingFaceEmbeddings(model_name='sentence-transformers/all-MiniLM-L12-v2'))
|
30 |
|
31 |
|
32 |
|
|
|
19 |
from langchain.prompts import PromptTemplate
|
20 |
from langchain.embeddings.huggingface import HuggingFaceEmbeddings
|
21 |
|
22 |
+
db = FAISS.load_local("faiss_index", HuggingFaceEmbeddings(model_name='sentence-transformers/all-MiniLM-L12-v2'),allow_dangerous_deserialization=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
|
25 |
|