Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,16 +3,16 @@ from gradio.mix import Parallel, Series
|
|
| 3 |
|
| 4 |
from transformers import pipeline
|
| 5 |
|
| 6 |
-
|
| 7 |
|
| 8 |
|
| 9 |
def translate(inp):
|
| 10 |
text = "en: " + inp
|
| 11 |
-
res =
|
| 12 |
text,
|
| 13 |
max_length=512,
|
| 14 |
early_stopping=True,
|
| 15 |
-
)[0]['translation_text']
|
| 16 |
return res
|
| 17 |
|
| 18 |
|
|
@@ -28,7 +28,7 @@ iface = gr.Interface(fn=translate,
|
|
| 28 |
label = 'Enter an article...'
|
| 29 |
),
|
| 30 |
outputs = 'text',
|
| 31 |
-
title = 'En
|
| 32 |
theme = 'grass',
|
| 33 |
layout = 'horizontal',
|
| 34 |
article=article,
|
|
|
|
| 3 |
|
| 4 |
from transformers import pipeline
|
| 5 |
|
| 6 |
+
translater = pipeline("translation", model="VietAI/envit5-translation")
|
| 7 |
|
| 8 |
|
| 9 |
def translate(inp):
|
| 10 |
text = "en: " + inp
|
| 11 |
+
res = translater(
|
| 12 |
text,
|
| 13 |
max_length=512,
|
| 14 |
early_stopping=True,
|
| 15 |
+
)[0]['translation_text'][3:]
|
| 16 |
return res
|
| 17 |
|
| 18 |
|
|
|
|
| 28 |
label = 'Enter an article...'
|
| 29 |
),
|
| 30 |
outputs = 'text',
|
| 31 |
+
title = 'En<->Vi MTet Translation',
|
| 32 |
theme = 'grass',
|
| 33 |
layout = 'horizontal',
|
| 34 |
article=article,
|