SAVAI123 commited on
Commit
06dc72e
·
verified ·
1 Parent(s): 58cf20f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
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=500, chunk_overlap=10)
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": 4})
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)}")