Update app.py
Browse files
app.py
CHANGED
|
@@ -60,7 +60,7 @@ def initialize_retriever():
|
|
| 60 |
print(f"Successfully loaded {len(documents)} pages from the PDF")
|
| 61 |
|
| 62 |
# Split text into chunks
|
| 63 |
-
text_splitter = RecursiveCharacterTextSplitter(chunk_size=
|
| 64 |
text_chunks = text_splitter.split_documents(documents)
|
| 65 |
print(f"Split into {len(text_chunks)} text chunks")
|
| 66 |
|
|
@@ -70,7 +70,7 @@ def initialize_retriever():
|
|
| 70 |
# Store embeddings in FAISS index
|
| 71 |
vectorstore = FAISS.from_documents(text_chunks, embeddings)
|
| 72 |
print("Successfully created vector store")
|
| 73 |
-
return vectorstore.as_retriever(search_kwargs={"k":
|
| 74 |
|
| 75 |
except Exception as e:
|
| 76 |
print(f"Error in initialize_retriever: {str(e)}")
|
|
|
|
| 60 |
print(f"Successfully loaded {len(documents)} pages from the PDF")
|
| 61 |
|
| 62 |
# Split text into chunks
|
| 63 |
+
text_splitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=150)
|
| 64 |
text_chunks = text_splitter.split_documents(documents)
|
| 65 |
print(f"Split into {len(text_chunks)} text chunks")
|
| 66 |
|
|
|
|
| 70 |
# Store embeddings in FAISS index
|
| 71 |
vectorstore = FAISS.from_documents(text_chunks, embeddings)
|
| 72 |
print("Successfully created vector store")
|
| 73 |
+
return vectorstore.as_retriever(search_kwargs={"k": 10})
|
| 74 |
|
| 75 |
except Exception as e:
|
| 76 |
print(f"Error in initialize_retriever: {str(e)}")
|