File size: 723 Bytes
bbda808
0652b75
bbda808
0652b75
bbda808
481878e
b07f85b
481878e
bbda808
 
 
481878e
 
bbda808
b7f051a
bbda808
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import gradio as gr
from optimum.pipelines import pipeline

pipeline = pipeline(task="translation", model="lgrobol/m2m100_418M_br_fr", accelerator="bettertransformer")

def predict(texts):
  predictions = pipeline(texts.splitlines(), src_lang="br", tgt_lang="fr")
  return "\n".join(p["translation_text"] for p in predictions)

gr.Interface(
    predict,
    inputs=gr.Textbox(label="Breton", placeholder="Entrez des phrases en Breton. Une phrase par ligne, une ligne par phrase."),
    outputs=gr.Textbox(label="Français"),
    title="Traduction Breton-Français",
    article="Cette interface utilse le modèle de traduction automatique [m2m100_418M_br_fr](https://huggingface.co./lgrobol/m2m100_418M_br_fr).",
).launch()