Spaces:
Build error
Build error
Commit
Β·
7825e2d
1
Parent(s):
9638484
Update app.py
Browse files
app.py
CHANGED
@@ -22,7 +22,8 @@ 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 |
-
|
|
|
26 |
|
27 |
|
28 |
iface = gr.Interface(
|
@@ -30,7 +31,7 @@ iface = gr.Interface(
|
|
30 |
|
31 |
#inputs=[gr.Textbox(lines=1, label="Vocabulary Token", placeholder="Enter token..."), gr.Number(value=50, label="number of neighbors")],
|
32 |
inputs=gr.Textbox(lines=1, label="Vocabulary Token", placeholder="Enter token..."),
|
33 |
-
outputs=gr.Textbox(label="Nearest subwords")
|
34 |
examples=[
|
35 |
["##logy"],
|
36 |
["##ness"],
|
|
|
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 |
+
results = hits.values[1:]
|
26 |
+
return [r for r in results if not "##" in r], [[r for r in results if "##" in r]]
|
27 |
|
28 |
|
29 |
iface = gr.Interface(
|
|
|
31 |
|
32 |
#inputs=[gr.Textbox(lines=1, label="Vocabulary Token", placeholder="Enter token..."), gr.Number(value=50, label="number of neighbors")],
|
33 |
inputs=gr.Textbox(lines=1, label="Vocabulary Token", placeholder="Enter token..."),
|
34 |
+
outputs=[gr.Textbox(label="Nearest tokens"), gr.Textbox(label="Nearest subwords")]
|
35 |
examples=[
|
36 |
["##logy"],
|
37 |
["##ness"],
|