Chris4K commited on
Commit
42d7c62
·
verified ·
1 Parent(s): 4848d67

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -8
app.py CHANGED
@@ -24,19 +24,14 @@ print("-----------")
24
  text_splitter = CharacterTextSplitter(chunk_size=100, chunk_overlap=0)
25
  vdocuments = text_splitter.split_documents(documents)
26
 
27
-
28
  # Extract the embedding arrays from the PDF documents
29
  embeddings = []
30
- for doc in documents:
31
- embeddings.append(getattr(doc, 'embeddings'))
32
-
33
 
34
  # Create Chroma vector store for API embeddings
35
  api_db = Chroma.from_documents(vdocuments, HfApiEmbeddingRetriever, collection_name="api-collection")
36
 
37
- #api_db = Chroma.from_texts(embeddings, api_hf_embeddings, collection_name="api-collection")
38
-
39
-
40
  # Define the PDF retrieval function
41
  def pdf_retrieval(query):
42
  # Run the query through the retriever
@@ -55,4 +50,4 @@ api_tool = gr.Interface(
55
  )
56
 
57
  # Launch the Gradio interface
58
- #api_tool.launch()
 
24
  text_splitter = CharacterTextSplitter(chunk_size=100, chunk_overlap=0)
25
  vdocuments = text_splitter.split_documents(documents)
26
 
 
27
  # Extract the embedding arrays from the PDF documents
28
  embeddings = []
29
+ for doc in vdocuments:
30
+ embeddings.extend(api_hf_embeddings.get_embeddings(doc))
 
31
 
32
  # Create Chroma vector store for API embeddings
33
  api_db = Chroma.from_documents(vdocuments, HfApiEmbeddingRetriever, collection_name="api-collection")
34
 
 
 
 
35
  # Define the PDF retrieval function
36
  def pdf_retrieval(query):
37
  # Run the query through the retriever
 
50
  )
51
 
52
  # Launch the Gradio interface
53
+ api_tool.launch()