Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -180,12 +180,11 @@ def get_llm():
|
|
180 |
return llm
|
181 |
|
182 |
# for chromadb vectore store
|
183 |
-
def get_embeddings():
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
return hf_embeddings
|
189 |
|
190 |
# call above functions
|
191 |
llm = get_llm()
|
@@ -279,7 +278,7 @@ def check_for_new_retrievers():
|
|
279 |
# loop through new docs in chroma retrievers created by user scraping/pdf (if any)
|
280 |
try:
|
281 |
for doc in new_documents_chroma:
|
282 |
-
if (("bm25/" + doc.split('/')[1] + ".pickle") in new_documents_bm25): # check that the doc also exists for bm25 retriever
|
283 |
|
284 |
new_doc_country = doc.split('_')[1]
|
285 |
new_doc_chunk_size = doc.split('_')[3]
|
|
|
180 |
return llm
|
181 |
|
182 |
# for chromadb vectore store
|
183 |
+
def get_embeddings():
|
184 |
+
# We use HuggingFaceEmbeddings() as it is open source and free to use.
|
185 |
+
# Initialize the default hf model for embedding the tokenized texts into vectors with semantic meanings
|
186 |
+
hf_embeddings = HuggingFaceEmbeddings()
|
187 |
+
return hf_embeddings
|
|
|
188 |
|
189 |
# call above functions
|
190 |
llm = get_llm()
|
|
|
278 |
# loop through new docs in chroma retrievers created by user scraping/pdf (if any)
|
279 |
try:
|
280 |
for doc in new_documents_chroma:
|
281 |
+
if ((("bm25\\" + doc.split('\\')[1] + ".pickle") in new_documents_bm25) | (("bm25/" + doc.split('/')[1] + ".pickle") in new_documents_bm25)): # check that the doc also exists for bm25 retriever
|
282 |
|
283 |
new_doc_country = doc.split('_')[1]
|
284 |
new_doc_chunk_size = doc.split('_')[3]
|