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() |