Spaces:
Sleeping
Sleeping
Update rss_processor.py
Browse files- rss_processor.py +7 -1
rss_processor.py
CHANGED
|
@@ -30,6 +30,11 @@ hf_api = HfApi()
|
|
| 30 |
|
| 31 |
embedding_model = HuggingFaceEmbeddings(model_name="sentence-transformers/all-MiniLM-L6-v2")
|
| 32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
def clean_text(text):
|
| 34 |
if not text or not isinstance(text, str):
|
| 35 |
return ""
|
|
@@ -162,7 +167,8 @@ def categorize_feed(url):
|
|
| 162 |
def process_and_store_articles(articles):
|
| 163 |
vector_db = Chroma(
|
| 164 |
persist_directory=LOCAL_DB_DIR,
|
| 165 |
-
embedding_function=get_embedding_model(),
|
|
|
|
| 166 |
collection_name=COLLECTION_NAME
|
| 167 |
)
|
| 168 |
|
|
|
|
| 30 |
|
| 31 |
embedding_model = HuggingFaceEmbeddings(model_name="sentence-transformers/all-MiniLM-L6-v2")
|
| 32 |
|
| 33 |
+
'''def get_embedding_model():
|
| 34 |
+
if not hasattr(get_embedding_model, "model"):
|
| 35 |
+
get_embedding_model.model = HuggingFaceEmbeddings(model_name="sentence-transformers/all-MiniLM-L6-v2")
|
| 36 |
+
return get_embedding_model.model'''
|
| 37 |
+
|
| 38 |
def clean_text(text):
|
| 39 |
if not text or not isinstance(text, str):
|
| 40 |
return ""
|
|
|
|
| 167 |
def process_and_store_articles(articles):
|
| 168 |
vector_db = Chroma(
|
| 169 |
persist_directory=LOCAL_DB_DIR,
|
| 170 |
+
#embedding_function=get_embedding_model(),
|
| 171 |
+
embedding_function=embedding_model.model,
|
| 172 |
collection_name=COLLECTION_NAME
|
| 173 |
)
|
| 174 |
|