thugCodeNinja commited on
Commit
cb0fc84
·
verified ·
1 Parent(s): 4943765

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -70,8 +70,8 @@ def process_text(input_text):
70
  # Calculate cosine similarity between the input text and the article text embeddings
71
  similarity = cosine_similarity(embedding1, embedding2)[0][0]
72
  if similarity > threshold:
73
- similar_articles.append({'Link': link, 'Similarity': similarity})
74
- similar_articles = sorted(similar_articles, key=lambda x: x['Similarity'], reverse=True)
75
  # Adjust the threshold as needed
76
  return similar_articles[:5]
77
 
 
70
  # Calculate cosine similarity between the input text and the article text embeddings
71
  similarity = cosine_similarity(embedding1, embedding2)[0][0]
72
  if similarity > threshold:
73
+ similar_articles.append([link,similarity])
74
+ similar_articles = sorted(similar_articles, key=lambda x: x[1], reverse=True)
75
  # Adjust the threshold as needed
76
  return similar_articles[:5]
77