Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -134,7 +134,7 @@ def create_embeddings(text_chunks):
|
|
| 134 |
chunk_embeddings = create_embeddings(brand_chunks)
|
| 135 |
|
| 136 |
# Define a function to find the most relevant text chunks for a given query, chunk_embeddings, and text_chunks
|
| 137 |
-
def get_top_chunks(query, chunk_embeddings, text_chunks):
|
| 138 |
if not text_chunks or chunk_embeddings is None or chunk_embeddings.size(0) == 0:
|
| 139 |
return []
|
| 140 |
# Convert the query text into a vector embedding
|
|
|
|
| 134 |
chunk_embeddings = create_embeddings(brand_chunks)
|
| 135 |
|
| 136 |
# Define a function to find the most relevant text chunks for a given query, chunk_embeddings, and text_chunks
|
| 137 |
+
def get_top_chunks(query, chunk_embeddings, text_chunks, top_k=7, similarity_threshold=0.4):
|
| 138 |
if not text_chunks or chunk_embeddings is None or chunk_embeddings.size(0) == 0:
|
| 139 |
return []
|
| 140 |
# Convert the query text into a vector embedding
|