Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -293,7 +293,7 @@ def compute_embeddings(texts, _model):
|
|
| 293 |
return _model.encode(texts, show_progress_bar=True)
|
| 294 |
|
| 295 |
# Semantic search
|
| 296 |
-
def semantic_search(query, embeddings, model, threshold=0.
|
| 297 |
query_embedding = model.encode([query])
|
| 298 |
sims = cosine_similarity(query_embedding, embeddings)[0]
|
| 299 |
return [(i, s) for i, s in enumerate(sims) if s > threshold]
|
|
|
|
| 293 |
return _model.encode(texts, show_progress_bar=True)
|
| 294 |
|
| 295 |
# Semantic search
|
| 296 |
+
def semantic_search(query, embeddings, model, threshold=0.5):
|
| 297 |
query_embedding = model.encode([query])
|
| 298 |
sims = cosine_similarity(query_embedding, embeddings)[0]
|
| 299 |
return [(i, s) for i, s in enumerate(sims) if s > threshold]
|