Spaces:
Runtime error
Runtime error
RajatChaudhari
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -32,14 +32,14 @@ pipe = pipeline("text-generation", model = model, tokenizer = tokenizer, max_new
|
|
32 |
hf = HuggingFacePipeline(pipeline=pipe)
|
33 |
|
34 |
def document_prep():
|
35 |
-
|
36 |
pdfLoader = PyPDFLoader("./LangchainPaper/RAGInputPaper.pdf")
|
37 |
documents = pdfLoader.load()
|
38 |
|
39 |
text_splitter = RecursiveCharacterTextSplitter(chunk_size = 512, chunk_overlap = 30)
|
40 |
docs = text_splitter.split_documents(documents)
|
41 |
|
42 |
-
creating vector embeddings during run using FAISS
|
43 |
vectorstore = FAISS.from_documents(
|
44 |
docs, embedding=embeddings
|
45 |
)
|
@@ -53,6 +53,7 @@ def load_vector():
|
|
53 |
return retriever
|
54 |
|
55 |
# call the function from which you want to load the vector
|
|
|
56 |
retriever=load_vector()
|
57 |
|
58 |
## In memory store
|
|
|
32 |
hf = HuggingFacePipeline(pipeline=pipe)
|
33 |
|
34 |
def document_prep():
|
35 |
+
|
36 |
pdfLoader = PyPDFLoader("./LangchainPaper/RAGInputPaper.pdf")
|
37 |
documents = pdfLoader.load()
|
38 |
|
39 |
text_splitter = RecursiveCharacterTextSplitter(chunk_size = 512, chunk_overlap = 30)
|
40 |
docs = text_splitter.split_documents(documents)
|
41 |
|
42 |
+
# creating vector embeddings during run using FAISS
|
43 |
vectorstore = FAISS.from_documents(
|
44 |
docs, embedding=embeddings
|
45 |
)
|
|
|
53 |
return retriever
|
54 |
|
55 |
# call the function from which you want to load the vector
|
56 |
+
retriever=document_prep()
|
57 |
retriever=load_vector()
|
58 |
|
59 |
## In memory store
|