Muzammil6376 commited on
Commit
ed57782
Β·
verified Β·
1 Parent(s): 225229c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -114,7 +114,12 @@ def process_pdf(pdf_file):
114
  combined_texts = chunks + caps
115
  combined_vectors = tvecs[:text_count] + ivecs
116
 
117
- index = FAISS.from_embeddings(texts=combined_texts, embeddings=combined_vectors)
 
 
 
 
 
118
  retriever = index.as_retriever(search_kwargs={"k":2})
119
  status = f"βœ… Indexed '{current_pdf_name}' β€” {len(chunks)} text chunks + {len(imgs)} images"
120
  return current_pdf_name, status, gr.update(interactive=True)
 
114
  combined_texts = chunks + caps
115
  combined_vectors = tvecs[:text_count] + ivecs
116
 
117
+ index = # Build FAISS index from precomputed multimodal vectors:
118
+ # (swap order: first embeddings, then texts)
119
+ index = FAISS.from_embeddings(
120
+ combined_vectors,
121
+ combined_texts
122
+ )
123
  retriever = index.as_retriever(search_kwargs={"k":2})
124
  status = f"βœ… Indexed '{current_pdf_name}' β€” {len(chunks)} text chunks + {len(imgs)} images"
125
  return current_pdf_name, status, gr.update(interactive=True)