Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -24,7 +24,7 @@ def compute_text_embeddings(list_of_strings):
|
|
| 24 |
result = model.get_text_features(**inputs).detach().numpy()
|
| 25 |
return result / np.linalg.norm(result, axis=1, keepdims=True)
|
| 26 |
|
| 27 |
-
def image_search(query, corpus, max_results=
|
| 28 |
positive_embeddings = None
|
| 29 |
|
| 30 |
def concatenate_embeddings(e1, e2):
|
|
@@ -68,7 +68,7 @@ def image_search(query, corpus, max_results=3):
|
|
| 68 |
dot_product2 = dot_product2 / np.max(dot_product2, axis=0, keepdims=True)
|
| 69 |
dot_product -= np.max(np.maximum(dot_product2, 0), axis=1)
|
| 70 |
|
| 71 |
-
results = np.argsort(dot_product)[-1 : -
|
| 72 |
return [
|
| 73 |
(
|
| 74 |
df[k].iloc[i]["path"],
|
|
|
|
| 24 |
result = model.get_text_features(**inputs).detach().numpy()
|
| 25 |
return result / np.linalg.norm(result, axis=1, keepdims=True)
|
| 26 |
|
| 27 |
+
def image_search(query, corpus, max_results=24):
|
| 28 |
positive_embeddings = None
|
| 29 |
|
| 30 |
def concatenate_embeddings(e1, e2):
|
|
|
|
| 68 |
dot_product2 = dot_product2 / np.max(dot_product2, axis=0, keepdims=True)
|
| 69 |
dot_product -= np.max(np.maximum(dot_product2, 0), axis=1)
|
| 70 |
|
| 71 |
+
results = np.argsort(dot_product)[-1 : -max_results - 1 : -1]
|
| 72 |
return [
|
| 73 |
(
|
| 74 |
df[k].iloc[i]["path"],
|