Mohamed-BC commited on
Commit
0c2b108
·
verified ·
1 Parent(s): d11233f

Update recommend.py

Browse files
Files changed (1) hide show
  1. recommend.py +1 -1
recommend.py CHANGED
@@ -13,7 +13,7 @@ def recommend(query, n=5):
13
  # Encode the query
14
  q_embedding = model.encode(query)
15
  # Calculate the cosine similarity
16
- cos_sim = np.array([1 - cosine(q_embedding, emb) for emb in a_embeddings)
17
  # Get the top n recommendations
18
  top_n = np.argsort(cos_sim)[-n:]
19
  return data.iloc[top_n]['title']
 
13
  # Encode the query
14
  q_embedding = model.encode(query)
15
  # Calculate the cosine similarity
16
+ cos_sim = np.array([1 - cosine(q_embedding, emb) for emb in a_embeddings])
17
  # Get the top n recommendations
18
  top_n = np.argsort(cos_sim)[-n:]
19
  return data.iloc[top_n]['title']