Spaces:
Runtime error
Runtime error
import gradio as gr | |
import fasttext | |
import fasttext.util | |
fasttext.util.download_model('fa', if_exists='ignore') # E Arabic | |
ft = fasttext.load_model('cc.fa.300.bin') | |
#ft = fasttext.load_model('cc.arz.300.bin') | |
fasttext.util.reduce_model(ft, 100) | |
def getVectors(fname): | |
# data = {} | |
data = ft.get_nearest_neighbors(fname, k=1) | |
return data | |
interface = gr.Interface(fn = getVectors, | |
inputs = "text", | |
outputs = "text", | |
title = 'Get Nearest Neighbors', | |
description = 'Get resultss for search') | |
interface.launch(inline = False) |