Spaces:
Runtime error
Runtime error
syedmudassir16
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -48,11 +48,14 @@ class DocumentRetrievalAndGeneration:
|
|
48 |
index = faiss.IndexFlatL2(vector_dimension)
|
49 |
index.add(embeddings)
|
50 |
|
|
|
|
|
|
|
51 |
# Create and return FAISS object
|
52 |
return FAISS(
|
53 |
embedding_function=self.embeddings.encode,
|
54 |
index=index,
|
55 |
-
docstore=
|
56 |
index_to_docstore_id={i: i for i in range(len(self.all_splits))}
|
57 |
)
|
58 |
|
|
|
48 |
index = faiss.IndexFlatL2(vector_dimension)
|
49 |
index.add(embeddings)
|
50 |
|
51 |
+
# Create docstore
|
52 |
+
docstore = {i: doc for i, doc in enumerate(self.all_splits)}
|
53 |
+
|
54 |
# Create and return FAISS object
|
55 |
return FAISS(
|
56 |
embedding_function=self.embeddings.encode,
|
57 |
index=index,
|
58 |
+
docstore=docstore,
|
59 |
index_to_docstore_id={i: i for i in range(len(self.all_splits))}
|
60 |
)
|
61 |
|