Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -121,9 +121,9 @@ EXAMPLES = [
|
|
| 121 |
]
|
| 122 |
|
| 123 |
if (
|
| 124 |
-
os.path.exists("
|
| 125 |
-
and os.path.exists("
|
| 126 |
-
and os.path.exists("
|
| 127 |
):
|
| 128 |
document_store = FAISSDocumentStore.load("./data/faiss_index")
|
| 129 |
retriever = Retriever(
|
|
@@ -133,14 +133,14 @@ if (
|
|
| 133 |
document_store.save(index_path="./data/faiss_index")
|
| 134 |
else:
|
| 135 |
try:
|
| 136 |
-
os.remove("
|
| 137 |
-
os.remove("
|
| 138 |
-
os.remove("
|
| 139 |
except FileNotFoundError:
|
| 140 |
pass
|
| 141 |
|
| 142 |
document_store = FAISSDocumentStore(
|
| 143 |
-
sql_url="sqlite
|
| 144 |
return_embedding=True,
|
| 145 |
embedding_dim=384,
|
| 146 |
)
|
|
@@ -151,7 +151,7 @@ else:
|
|
| 151 |
document_store=document_store, top_k=TOP_K, batch_size=BATCH_SIZE
|
| 152 |
)
|
| 153 |
document_store.update_embeddings(retriever=retriever)
|
| 154 |
-
document_store.save(index_path="
|
| 155 |
|
| 156 |
ranker = Ranker()
|
| 157 |
|
|
|
|
| 121 |
]
|
| 122 |
|
| 123 |
if (
|
| 124 |
+
os.path.exists("/data/faiss_document_store.db")
|
| 125 |
+
and os.path.exists("/data/faiss_index.json")
|
| 126 |
+
and os.path.exists("/data/faiss_index")
|
| 127 |
):
|
| 128 |
document_store = FAISSDocumentStore.load("./data/faiss_index")
|
| 129 |
retriever = Retriever(
|
|
|
|
| 133 |
document_store.save(index_path="./data/faiss_index")
|
| 134 |
else:
|
| 135 |
try:
|
| 136 |
+
os.remove("/data/faiss_index")
|
| 137 |
+
os.remove("/data/faiss_index.json")
|
| 138 |
+
os.remove("/data/faiss_document_store.db")
|
| 139 |
except FileNotFoundError:
|
| 140 |
pass
|
| 141 |
|
| 142 |
document_store = FAISSDocumentStore(
|
| 143 |
+
sql_url="sqlite:////data/faiss_document_store.db",
|
| 144 |
return_embedding=True,
|
| 145 |
embedding_dim=384,
|
| 146 |
)
|
|
|
|
| 151 |
document_store=document_store, top_k=TOP_K, batch_size=BATCH_SIZE
|
| 152 |
)
|
| 153 |
document_store.update_embeddings(retriever=retriever)
|
| 154 |
+
document_store.save(index_path="/data/faiss_index")
|
| 155 |
|
| 156 |
ranker = Ranker()
|
| 157 |
|