Commit 27eeac2a authored by 赵威's avatar 赵威

write data to diary

parent 6cd1c997
......@@ -10,7 +10,7 @@ import numpy as np
from bert_serving.client import BertClient
from utils.cache import redis_client_db
from utils.es import get_diary_info_from_es
from utils.files import MODEL_PATH, DATA_PATH
from utils.files import DATA_PATH, MODEL_PATH
def save_result():
......@@ -18,9 +18,7 @@ def save_result():
index_path = os.path.join(MODEL_PATH, "faiss_diary_similarity.index")
faiss_index = faiss.read_index(index_path)
print(faiss_index)
with open(os.path.join(DATA_PATH, "diary_similarity.log"), "w") as f:
count = 0
for item in get_diary_info_from_es(["id", "answer", "content_level"]):
count += 1
......@@ -40,9 +38,10 @@ def save_result():
if res:
data = "{}:{}:{}".format(content_level, str(id), ",".join(res))
print(data)
f.write(data)
except Exception as e:
print(e)
print("done")
if __name__ == "__main__":
# bc = BertClient("172.16.44.82", check_length=False)
......
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