Update app.py
Browse files
app.py
CHANGED
@@ -29,7 +29,9 @@ def mapping_code(user_input):
|
|
29 |
if len(user_input.split()) <= 1: # Check if sentence has less than 5 words
|
30 |
raise ValueError("Input sentence should be more than 1 word long.Please provide the Full description")
|
31 |
emb1 = model.encode(user_input.lower())
|
32 |
-
similarities = util.pytorch_cos_sim(emb1, stored_embeddings)[0]
|
|
|
|
|
33 |
# Combine similarity scores with 'code' and 'description'
|
34 |
result = [(code, description, float(sim)) for code, description, sim in zip(stored_data["SBS_code"], stored_data["Description"], similarities)]
|
35 |
# Sort results by similarity scores
|
|
|
29 |
if len(user_input.split()) <= 1: # Check if sentence has less than 5 words
|
30 |
raise ValueError("Input sentence should be more than 1 word long.Please provide the Full description")
|
31 |
emb1 = model.encode(user_input.lower())
|
32 |
+
#similarities = util.pytorch_cos_sim(emb1, stored_embeddings)[0]
|
33 |
+
similarity = util.cos_sim(sentence, emb1)
|
34 |
+
|
35 |
# Combine similarity scores with 'code' and 'description'
|
36 |
result = [(code, description, float(sim)) for code, description, sim in zip(stored_data["SBS_code"], stored_data["Description"], similarities)]
|
37 |
# Sort results by similarity scores
|