fasttext / app.py
ArtMirror2000's picture
Update app.py
3f626ff
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)