Spaces:
Build error
Build error
Commit
Β·
fa47917
1
Parent(s):
c6923f5
Update app.py
Browse files
app.py
CHANGED
@@ -18,9 +18,9 @@ def get_first_subword(word):
|
|
18 |
except:
|
19 |
return tokenizer(word, add_special_tokens=False)['input_ids'][0]
|
20 |
|
21 |
-
def search(token_to_lookup, num_neighbors):
|
22 |
i = get_first_subword(token_to_lookup)
|
23 |
-
_ , I = index.search(input_embeddings[i:i+1], num_neighbors
|
24 |
hits = lookup_table.take(I[0])
|
25 |
return hits.values[1:]
|
26 |
|
|
|
18 |
except:
|
19 |
return tokenizer(word, add_special_tokens=False)['input_ids'][0]
|
20 |
|
21 |
+
def search(token_to_lookup, num_neighbors=50):
|
22 |
i = get_first_subword(token_to_lookup)
|
23 |
+
_ , I = index.search(input_embeddings[i:i+1], num_neighbors)
|
24 |
hits = lookup_table.take(I[0])
|
25 |
return hits.values[1:]
|
26 |
|