Upload app.py
Browse files
app.py
CHANGED
@@ -129,7 +129,21 @@ def load_pdf(files):
|
|
129 |
# Store the embeddings in the vector store
|
130 |
vector_store = FAISS.from_documents(texts, embeddings)
|
131 |
|
132 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
133 |
|
134 |
|
135 |
def format_docs(docs):
|
|
|
129 |
# Store the embeddings in the vector store
|
130 |
vector_store = FAISS.from_documents(texts, embeddings)
|
131 |
|
132 |
+
# Check vector database status
|
133 |
+
num_indexed_vectors = 0
|
134 |
+
if hasattr(vector_store, 'index') and hasattr(vector_store.index, 'ntotal'):
|
135 |
+
num_indexed_vectors = vector_store.index.ntotal
|
136 |
+
|
137 |
+
num_documents_in_docstore = 0
|
138 |
+
if hasattr(vector_store, 'docstore') and hasattr(vector_store.docstore, 'lc_kwargs'):
|
139 |
+
num_documents_in_docstore = len(vector_store.docstore._dict)
|
140 |
+
|
141 |
+
status_message = (
|
142 |
+
f"PDF(s) indexed successfully!\n"
|
143 |
+
f"Total chunks processed: {len(texts)}, Vectors indexed: {num_indexed_vectors}, Documents: {num_documents_in_docstore}\n"
|
144 |
+
)
|
145 |
+
|
146 |
+
return status_message
|
147 |
|
148 |
|
149 |
def format_docs(docs):
|