File size: 463 Bytes
807cf21
d1c8038
 
 
807cf21
d1c8038
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import gradio as gr
from transformers import pipeline
import fasttext
from huggingface_hub import hf_hub_download

model_path = hf_hub_download(repo_id="facebook/fasttext-language-identification", filename="model.bin")
model = fasttext.load_model(model_path)

def launch(input):
    out = model.predict(input)
    return out[0][0]

iface = gr.Interface(launch,
                     inputs=gr.Text(type='text'),
                     outputs="text")

iface.launch()