Spaces:
Build error
Build error
Update utils.py
Browse files
utils.py
CHANGED
|
@@ -15,11 +15,12 @@ def setup():
|
|
| 15 |
db = Chroma.from_documents(document, embedding)
|
| 16 |
return db
|
| 17 |
|
| 18 |
-
|
| 19 |
def find_match(input):
|
| 20 |
# input_em = model.encode(input).tolist()
|
| 21 |
# result = index.query(input_em, top_k=2, includeMetadata=True)
|
| 22 |
# return result['matches'][0]['metadata']['text']+"\n"+result['matches'][1]['metadata']['text']
|
|
|
|
| 23 |
matching_doc=db.similarity_search_with_score(input,k=2)
|
| 24 |
return matching_doc[0][0].page_content+matching_doc[1][0].page_content
|
| 25 |
|
|
|
|
| 15 |
db = Chroma.from_documents(document, embedding)
|
| 16 |
return db
|
| 17 |
|
| 18 |
+
|
| 19 |
def find_match(input):
|
| 20 |
# input_em = model.encode(input).tolist()
|
| 21 |
# result = index.query(input_em, top_k=2, includeMetadata=True)
|
| 22 |
# return result['matches'][0]['metadata']['text']+"\n"+result['matches'][1]['metadata']['text']
|
| 23 |
+
db=setup()
|
| 24 |
matching_doc=db.similarity_search_with_score(input,k=2)
|
| 25 |
return matching_doc[0][0].page_content+matching_doc[1][0].page_content
|
| 26 |
|