Spaces:
Runtime error
Runtime error
File size: 541 Bytes
43fda7e aefde91 03a158c 6041521 43fda7e b8098f4 4fcd305 43fda7e 3f626ff 6844908 43fda7e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
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) |