Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -71,7 +71,7 @@ def process_text(input_text):
|
|
71 |
# Calculate cosine similarity between the input text and the article text embeddings
|
72 |
similarity = cosine_similarity(embedding1, embedding2)[0][0]
|
73 |
if similarity > threshold:
|
74 |
-
similar_articles.append([link,similarity])
|
75 |
similar_articles = sorted(similar_articles, key=lambda x: x[1], reverse=True)
|
76 |
#threshold = 0.5 # Adjust the threshold as needed
|
77 |
return similar_articles[:5]
|
|
|
71 |
# Calculate cosine similarity between the input text and the article text embeddings
|
72 |
similarity = cosine_similarity(embedding1, embedding2)[0][0]
|
73 |
if similarity > threshold:
|
74 |
+
similar_articles.append([link,float(similarity)])
|
75 |
similar_articles = sorted(similar_articles, key=lambda x: x[1], reverse=True)
|
76 |
#threshold = 0.5 # Adjust the threshold as needed
|
77 |
return similar_articles[:5]
|