fittar's picture
Update app.py
98c64dd
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)