diff --git a/knn_on_parlai/server.py b/knn_on_parlai/server.py index 96b9249..fdee08d 100644 --- a/knn_on_parlai/server.py +++ b/knn_on_parlai/server.py @@ -19,13 +19,13 @@ def respond(): embed = get_embed(question, vectors) got_ind = u.get_nns_by_vector(embed, 1) - best_ans, found = make_new_facts(index_to_answer[got_ind[0]], bio) + # best_ans, found = make_new_facts(index_to_answer[got_ind[0]], bio) # for i in got_ind: # ans_with_facts, found = make_new_facts(index_to_answer[i], bio) # if found: # return jsonify({'message': ans_with_facts}) - return jsonify({'message': best_ans}) + return jsonify({'message': index_to_answer[got_ind[0]]}) def load_obj(name): @@ -41,8 +41,8 @@ def get_embed(text, vectors): u = AnnoyIndex(300) -u.load('db_qa_facts_tokenized.ann') -index_to_answer = load_obj("db_qa_facts_tokenized_index_to_answer") +u.load('db_qa.ann') +index_to_answer = load_obj("db_qa_index_to_answer") vectors = Magnitude("wiki-news-300d-1M-subword.magnitude") app.run(debug=False, host='0.0.0.0', port=3031) diff --git a/setup.sh b/setup.sh index 19bcff7..9841223 100755 --- a/setup.sh +++ b/setup.sh @@ -34,6 +34,6 @@ wget -P dialog_tracker/data/ https://s3.eu-central-1.amazonaws.com/convai/model- # knn on parlai wget -P knn_on_parlai https://s3.eu-central-1.amazonaws.com/convai/wiki-news-300d-1M-subword.magnitude -wget -P knn_on_parlai https://www.dropbox.com/s/fc6i8c6x76glwkp/db_qa_facts_tokenized_index_to_answer.pkl -wget -P knn_on_parlai https://www.dropbox.com/s/k2dvcmadqxeanqd/db_qa_facts_tokenized.ann -wget -P knn_on_parlai https://www.dropbox.com/s/hry5astqsxmlqws/db_qa_facts_tokenized.json +wget -P knn_on_parlai https://www.dropbox.com/s/gfdre8hassbs3ly/db_qa_index_to_answer.pkl?dl=0 +wget -P knn_on_parlai https://www.dropbox.com/s/iiyvllsuzfuseaf/db_qa.ann?dl=0 +wget -P knn_on_parlai https://www.dropbox.com/s/s1zeqs5s8pgjrja/db_qa.json?dl=0