Commit 965c7987 authored by 赵威's avatar 赵威

update index name

parent 92a79400
...@@ -17,8 +17,8 @@ def save_result(): ...@@ -17,8 +17,8 @@ def save_result():
bc = BertClient("172.16.44.82", check_length=False) bc = BertClient("172.16.44.82", check_length=False)
index_path = os.path.join(MODEL_PATH, "faiss_diary_similarity.index") index_path = os.path.join(MODEL_PATH, "faiss_diary_similarity.index")
index = faiss.read_index(index_path) faiss_index = faiss.read_index(index_path)
print(index) print(faiss_index)
# level_dict = {"6": set([]), "5": set([]), "4": set([]), "3.5": set([]), "3": set([])} # level_dict = {"6": set([]), "5": set([]), "4": set([]), "3.5": set([]), "3": set([])}
count = 0 count = 0
...@@ -30,7 +30,7 @@ def save_result(): ...@@ -30,7 +30,7 @@ def save_result():
# level_dict[content_level].add(id) # level_dict[content_level].add(id)
try: try:
emb = np.array([bc.encode([content]).tolist()[0]]).astype("float32") emb = np.array([bc.encode([content]).tolist()[0]]).astype("float32")
D, I = index.search(emb, 10) D, I = faiss_index.search(emb, 10)
distances = D.tolist()[0] distances = D.tolist()[0]
ids = I.tolist()[0] ids = I.tolist()[0]
res = [] res = []
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment