LalitMahale
commited on
Commit
·
f2e2bb3
1
Parent(s):
7fa286a
change statergy
Browse files- .gitignore +2 -0
- all_answers.pkl +0 -0
- all_merged_list.pkl +0 -0
- all_mix_embedding.pkl +0 -0
- main.py +4 -3
.gitignore
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
__py*
|
| 2 |
+
utils/__py*
|
all_answers.pkl
CHANGED
|
Binary files a/all_answers.pkl and b/all_answers.pkl differ
|
|
|
all_merged_list.pkl
ADDED
|
Binary file (71.6 kB). View file
|
|
|
all_mix_embedding.pkl
CHANGED
|
Binary files a/all_mix_embedding.pkl and b/all_mix_embedding.pkl differ
|
|
|
main.py
CHANGED
|
@@ -32,12 +32,13 @@ def process(user_query:str):
|
|
| 32 |
similarity_scores = cosine_similarity(user_embedding, load_embedding)
|
| 33 |
index = np.argmax(similarity_scores)
|
| 34 |
answer = ans[index]
|
| 35 |
-
print(f"{index}:\t {user_query}")
|
| 36 |
score = similarity_scores[0,index]
|
| 37 |
-
|
|
|
|
|
|
|
| 38 |
final_output = random.choice(answer)
|
| 39 |
else:
|
| 40 |
-
final_output = "Sorry, I
|
| 41 |
|
| 42 |
return final_output
|
| 43 |
|
|
|
|
| 32 |
similarity_scores = cosine_similarity(user_embedding, load_embedding)
|
| 33 |
index = np.argmax(similarity_scores)
|
| 34 |
answer = ans[index]
|
|
|
|
| 35 |
score = similarity_scores[0,index]
|
| 36 |
+
print(f"Index : {index}:\tscore:{score} \tquery: {user_query}")
|
| 37 |
+
|
| 38 |
+
if float(score) > 0.45 :
|
| 39 |
final_output = random.choice(answer)
|
| 40 |
else:
|
| 41 |
+
final_output = "Sorry, I did not understand."
|
| 42 |
|
| 43 |
return final_output
|
| 44 |
|