Spaces:
Sleeping
Sleeping
Pedro Gengo
commited on
Commit
·
7c0d447
1
Parent(s):
4074cac
Adding app
Browse files
app.py
CHANGED
@@ -23,9 +23,9 @@ print("Index loaded successfully")
|
|
23 |
|
24 |
def encode_query(query):
|
25 |
query_embeddings = model.encode([query], convert_to_tensor=True)
|
26 |
-
query_embeddings = F.layer_norm(
|
27 |
-
query_embeddings =
|
28 |
-
query_embeddings = F.normalize(
|
29 |
return query_embeddings
|
30 |
|
31 |
def search_nearest_papers(query, k=5):
|
|
|
23 |
|
24 |
def encode_query(query):
|
25 |
query_embeddings = model.encode([query], convert_to_tensor=True)
|
26 |
+
query_embeddings = F.layer_norm(query_embeddings, normalized_shape=(query_embeddings.shape[1],))
|
27 |
+
query_embeddings = query_embeddings[:, :DIM]
|
28 |
+
query_embeddings = F.normalize(query_embeddings, p=2, dim=1)
|
29 |
return query_embeddings
|
30 |
|
31 |
def search_nearest_papers(query, k=5):
|