Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -28,8 +28,10 @@ class MyApp:
|
|
| 28 |
self.documents.append({"page": page_num + 1, "content": text})
|
| 29 |
print("PDF processed successfully!")
|
| 30 |
|
|
|
|
| 31 |
def build_vector_db(self) -> None:
|
| 32 |
"""Builds a vector database using the content of the PDF."""
|
|
|
|
| 33 |
model = SentenceTransformer('all-MiniLM-L6-v2')
|
| 34 |
self.embeddings = model.encode([doc["content"] for doc in self.documents], show_progress_bar=True)
|
| 35 |
self.index = faiss.IndexFlatL2(self.embeddings.shape[1])
|
|
|
|
| 28 |
self.documents.append({"page": page_num + 1, "content": text})
|
| 29 |
print("PDF processed successfully!")
|
| 30 |
|
| 31 |
+
|
| 32 |
def build_vector_db(self) -> None:
|
| 33 |
"""Builds a vector database using the content of the PDF."""
|
| 34 |
+
print(self.documents)
|
| 35 |
model = SentenceTransformer('all-MiniLM-L6-v2')
|
| 36 |
self.embeddings = model.encode([doc["content"] for doc in self.documents], show_progress_bar=True)
|
| 37 |
self.index = faiss.IndexFlatL2(self.embeddings.shape[1])
|