aminaj commited on
Commit
e08a2c4
·
verified ·
1 Parent(s): 737f71b

Update newsletter_api.py

Browse files
Files changed (1) hide show
  1. newsletter_api.py +3 -3
newsletter_api.py CHANGED
@@ -6,7 +6,7 @@ import os
6
 
7
  from sentence_transformers import SentenceTransformer, util
8
 
9
- model = SentenceTransformer("all-MiniLM-L6-v2") # lightweight and fast
10
 
11
  app = FastAPI()
12
 
@@ -60,12 +60,12 @@ def extract_news_from_rss(feed_urls: list[str], topic: str, threshold: float = 0
60
  else:
61
  content = ''
62
 
63
- article_text = title + " " + summary + " " + content
64
  article_embedding = model.encode(article_text, convert_to_tensor=True)
65
 
66
  score = util.cos_sim(article_embedding, topic_embedding).item()
67
 
68
- # Replace double quotes inside title, summary, and content with single quotes
69
  title = title.replace('"', "'")
70
  summary = summary.replace('"', "'")
71
  content = content.replace('"', "'")
 
6
 
7
  from sentence_transformers import SentenceTransformer, util
8
 
9
+ model = SentenceTransformer("nomic-ai/nomic-embed-text-v1") # lightweight and fast
10
 
11
  app = FastAPI()
12
 
 
60
  else:
61
  content = ''
62
 
63
+ article_text = title + " " + summary
64
  article_embedding = model.encode(article_text, convert_to_tensor=True)
65
 
66
  score = util.cos_sim(article_embedding, topic_embedding).item()
67
 
68
+ # Replace double quotes inside title and summary with single quotes
69
  title = title.replace('"', "'")
70
  summary = summary.replace('"', "'")
71
  content = content.replace('"', "'")