Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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(
|
74 |
-
similar_articles = sorted(similar_articles, key=lambda x: x[
|
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 |
|