Update app.py
Browse files
app.py
CHANGED
|
@@ -2,13 +2,13 @@ from transformers import pipeline
|
|
| 2 |
import gradio as gr
|
| 3 |
|
| 4 |
translator = pipeline(
|
| 5 |
-
|
| 6 |
model="Helsinki-NLP/opus-mt-ru-vi"
|
| 7 |
)
|
| 8 |
|
| 9 |
def translate(text):
|
| 10 |
-
result = translator(text
|
| 11 |
-
return result[0]["
|
| 12 |
|
| 13 |
iface = gr.Interface(
|
| 14 |
fn=translate,
|
|
@@ -16,7 +16,7 @@ iface = gr.Interface(
|
|
| 16 |
lines=2,
|
| 17 |
placeholder="Nhập tiếng Nga..."
|
| 18 |
),
|
| 19 |
-
outputs=
|
| 20 |
title="🇷🇺 Nga → Việt",
|
| 21 |
description="Mini translator for Notion"
|
| 22 |
)
|
|
|
|
| 2 |
import gradio as gr
|
| 3 |
|
| 4 |
translator = pipeline(
|
| 5 |
+
"translation_ru_to_vi",
|
| 6 |
model="Helsinki-NLP/opus-mt-ru-vi"
|
| 7 |
)
|
| 8 |
|
| 9 |
def translate(text):
|
| 10 |
+
result = translator(text)
|
| 11 |
+
return result[0]["translation_text"]
|
| 12 |
|
| 13 |
iface = gr.Interface(
|
| 14 |
fn=translate,
|
|
|
|
| 16 |
lines=2,
|
| 17 |
placeholder="Nhập tiếng Nga..."
|
| 18 |
),
|
| 19 |
+
outputs=gr.Textbox(),
|
| 20 |
title="🇷🇺 Nga → Việt",
|
| 21 |
description="Mini translator for Notion"
|
| 22 |
)
|