Jay4769 commited on
Commit
4f06877
·
verified ·
1 Parent(s): 8329098

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -2,13 +2,13 @@ from transformers import pipeline
2
  import gradio as gr
3
 
4
  translator = pipeline(
5
- task="text2text-generation",
6
  model="Helsinki-NLP/opus-mt-ru-vi"
7
  )
8
 
9
  def translate(text):
10
- result = translator(text, max_length=400)
11
- return result[0]["generated_text"]
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="text",
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
  )