File size: 1,050 Bytes
f1ddc13
 
 
 
4a66608
f1ddc13
 
 
026fc62
 
f1ddc13
 
 
 
 
 
 
 
 
1f807d5
98c64dd
f1ddc13
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import gradio as gr

import gensim

model_g = gensim.models.KeyedVectors.load_word2vec_format('v_glove_300d_2.0' , binary=True)

#retrieve the most similar words

def generate(word):
    result= model_g.most_similar(word,topn=10)
    return result


examples = [
    ["sad"],
    ["together"],
    ["lake"]
]

title = "Visually Grounded Embeddings"
description = 'Get the top 10 nearest neighbors with cosine similarities from a visually grounded word embedding model described in [this paper](https://arxiv.org/abs/2206.08823). These embeddings have been shown to strongly correlate with human judgment on [word similarity benchmarks](https://github.com/vecto-ai/word-benchmarks).<br>'
txt = gr.Textbox(lines=1, label="Query word", placeholder="muffin")
out = gr.Textbox(lines=4, label="top 10 nearest neighbors")

demo = gr.Interface(
    fn =generate,
    inputs=txt,
    outputs=out,
    examples=examples,
    title=title,
    description=description,
    theme="default",
    cache_examples="never"
)

demo.launch(enable_queue=True, debug=True)