CoolFace
Apppublic

ArtMirror2000/fasttext

sourceHugging Faceafl-3.0updated 4y agoView on Hugging Face
0likes
app.py21 linesDownload Raw Back to root
1import gradio as gr2import fasttext3import fasttext.util4 5fasttext.util.download_model('fa', if_exists='ignore')  # E Arabic6ft = fasttext.load_model('cc.fa.300.bin')7#ft = fasttext.load_model('cc.arz.300.bin')8fasttext.util.reduce_model(ft, 100)9 10def getVectors(fname):11    # data = {}12    data = ft.get_nearest_neighbors(fname,  k=1)13    return data14    15interface = gr.Interface(fn = getVectors,16inputs = "text",17outputs = "text",18title = 'Get Nearest Neighbors',19description = 'Get resultss for search')20 21interface.launch(inline = False)