lgrobol commited on
Commit
481878e
1 Parent(s): e15b9d3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -3,13 +3,13 @@ from transformers import pipeline
3
 
4
  pipeline = pipeline(task="translation", model="lgrobol/m2m100_418M_br_fr")
5
 
6
- def predict(text):
7
- predictions = pipeline(text, src_lang="br", tgt_lang="fr")
8
- return predictions[0]["translation_text"]
9
 
10
  gr.Interface(
11
  predict,
12
- inputs=gr.Textbox(placeholder="Entrez un texte en Breton"),
13
- outputs=gr.Textbox(),
14
  title="Traduction Breton-Français",
15
  ).launch()
 
3
 
4
  pipeline = pipeline(task="translation", model="lgrobol/m2m100_418M_br_fr")
5
 
6
+ def predict(texts):
7
+ predictions = pipeline(text.splitlines(), src_lang="br", tgt_lang="fr")
8
+ return "\n".join(p["translation_text"] for p in predictions)
9
 
10
  gr.Interface(
11
  predict,
12
+ inputs=gr.Textbox(label="Breton", placeholder="Entrez des phrases en Breton. Une phrase par ligne, une ligne par phrase."),
13
+ outputs=gr.Textbox(label="Français"),
14
  title="Traduction Breton-Français",
15
  ).launch()