Spaces:
Sleeping
Sleeping
Change faiss index path
Browse files
app.py
CHANGED
|
@@ -38,6 +38,8 @@ DATABASE_CONFIG = {
|
|
| 38 |
"triplets_db": os.path.join(BASE_DIR, "triplets_new.db"),
|
| 39 |
"definitions_db": os.path.join(BASE_DIR, "relations_new.db"),
|
| 40 |
"news_db": os.path.join(BASE_DIR, "cnnhealthnews2.db"),
|
|
|
|
|
|
|
| 41 |
"triplets_table": "triplets",
|
| 42 |
"definitions_table": "relations",
|
| 43 |
"head_column": "head_entity",
|
|
@@ -146,7 +148,7 @@ def retrieve_triplets(query: str) -> Tuple[List[Tuple[str, str, str]], List[Tupl
|
|
| 146 |
|
| 147 |
dummy_embeddings = FakeEmbeddings(size=768)
|
| 148 |
triplets_store = FAISS.load_local(
|
| 149 |
-
"
|
| 150 |
)
|
| 151 |
triplets_store.index.nprobe = 100
|
| 152 |
triplets_store._normalize_L2 = True
|
|
@@ -215,7 +217,7 @@ def retrieve_news(query: str) -> Dict[str, str]:
|
|
| 215 |
|
| 216 |
dummy_embeddings = FakeEmbeddings(size=768)
|
| 217 |
news_store = FAISS.load_local(
|
| 218 |
-
"
|
| 219 |
)
|
| 220 |
news_store.index.nprobe = 100
|
| 221 |
news_store._normalize_L2 = True
|
|
|
|
| 38 |
"triplets_db": os.path.join(BASE_DIR, "triplets_new.db"),
|
| 39 |
"definitions_db": os.path.join(BASE_DIR, "relations_new.db"),
|
| 40 |
"news_db": os.path.join(BASE_DIR, "cnnhealthnews2.db"),
|
| 41 |
+
"news_faiss": os.path.join(BASE_DIR, "news_index_compressed"),
|
| 42 |
+
"triplets_faiss": os.path.join(BASE_DIR, "triplets_index_compressed"),
|
| 43 |
"triplets_table": "triplets",
|
| 44 |
"definitions_table": "relations",
|
| 45 |
"head_column": "head_entity",
|
|
|
|
| 148 |
|
| 149 |
dummy_embeddings = FakeEmbeddings(size=768)
|
| 150 |
triplets_store = FAISS.load_local(
|
| 151 |
+
DATABASE_CONFIG["triplets_faiss"], dummy_embeddings, allow_dangerous_deserialization=True
|
| 152 |
)
|
| 153 |
triplets_store.index.nprobe = 100
|
| 154 |
triplets_store._normalize_L2 = True
|
|
|
|
| 217 |
|
| 218 |
dummy_embeddings = FakeEmbeddings(size=768)
|
| 219 |
news_store = FAISS.load_local(
|
| 220 |
+
DATABASE_CONFIG["news_faiss"], dummy_embeddings, allow_dangerous_deserialization=True
|
| 221 |
)
|
| 222 |
news_store.index.nprobe = 100
|
| 223 |
news_store._normalize_L2 = True
|