Chris4K commited on
Commit
6976271
·
verified ·
1 Parent(s): 842c848

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -17,6 +17,9 @@ documents = loader.load()
17
  text_splitter = CharacterTextSplitter(chunk_size=100, chunk_overlap=0)
18
  vdocuments = text_splitter.split_documents(documents)
19
 
 
 
 
20
  model = "BAAI/bge-base-en-v1.5"
21
  encode_kwargs = {
22
  "normalize_embeddings": True
@@ -26,7 +29,7 @@ embeddings = HuggingFaceBgeEmbeddings(
26
  )
27
 
28
  # Create FAISS vector store for API embeddings
29
- api_db = FAISS.from_texts(texts=vdocuments, embedding=embeddings)
30
 
31
  # Define the PDF retrieval function
32
  def pdf_retrieval(query):
 
17
  text_splitter = CharacterTextSplitter(chunk_size=100, chunk_overlap=0)
18
  vdocuments = text_splitter.split_documents(documents)
19
 
20
+ # Extract the text from the Document objects
21
+ docs_text = [doc.text for doc in vdocuments]
22
+
23
  model = "BAAI/bge-base-en-v1.5"
24
  encode_kwargs = {
25
  "normalize_embeddings": True
 
29
  )
30
 
31
  # Create FAISS vector store for API embeddings
32
+ api_db = FAISS.from_texts(texts=docs_text, embedding=embeddings)
33
 
34
  # Define the PDF retrieval function
35
  def pdf_retrieval(query):