Spaces:
Runtime error
Runtime error
Download app.py from ArtMirror2000/fasttext: direct link, hf CLI and curl.
- Browser
- Download file 541 Bytes
-
https://huggingface.co/spaces/ArtMirror2000/fasttext/resolve/main/app.py
- Command line
-
hf download hf://spaces/ArtMirror2000/fasttext/app.py
-
curl -L -o app.py https://huggingface.co/spaces/ArtMirror2000/fasttext/resolve/main/app.py
541 Bytes
| 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) |