Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -114,15 +114,14 @@ def process_pdf(pdf_file):
|
|
114 |
combined_texts = chunks + caps
|
115 |
combined_vectors = tvecs[:text_count] + ivecs
|
116 |
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
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)
|
126 |
|
127 |
|
128 |
def ask_question(pdf_name,question):
|
|
|
114 |
combined_texts = chunks + caps
|
115 |
combined_vectors = tvecs[:text_count] + ivecs
|
116 |
|
117 |
+
# Build FAISS index from precomputed multimodal vectors:
|
118 |
+
index = FAISS.from_embeddings(
|
119 |
+
combined_vectors,
|
120 |
+
combined_texts,
|
121 |
+
)
|
|
|
122 |
retriever = index.as_retriever(search_kwargs={"k":2})
|
123 |
status = f"β
Indexed '{current_pdf_name}' β {len(chunks)} text chunks + {len(imgs)} images"
|
124 |
+
return current_pdf_name, status, gr.update(interactive=True)interactive=True)
|
125 |
|
126 |
|
127 |
def ask_question(pdf_name,question):
|