japanese-denim commited on
Commit
d4fb67d
1 Parent(s): 56fb26e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -2,7 +2,7 @@ import gradio as gr
2
  from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, pipeline
3
  import torch
4
 
5
- model_checkpoint = "japanese-denim/mbart-50-finetuned-naga-to-eng"
6
  model = AutoModelForSeq2SeqLM.from_pretrained(model_checkpoint)
7
  tokenizer = AutoTokenizer.from_pretrained(model_checkpoint)
8
 
@@ -10,8 +10,8 @@ def translate(text):
10
  translation_pipeline = pipeline("translation",
11
  model=model,
12
  tokenizer = tokenizer,
13
- src_lang='ng_XX',
14
- tgt_lang='en_XX')
15
 
16
  result = translation_pipeline(text)
17
  return result[0]['translation_text']
 
2
  from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, pipeline
3
  import torch
4
 
5
+ model_checkpoint = "japanese-denim/m2m-finetuned-naga-to-eng"
6
  model = AutoModelForSeq2SeqLM.from_pretrained(model_checkpoint)
7
  tokenizer = AutoTokenizer.from_pretrained(model_checkpoint)
8
 
 
10
  translation_pipeline = pipeline("translation",
11
  model=model,
12
  tokenizer = tokenizer,
13
+ src_lang='en',
14
+ tgt_lang='en')
15
 
16
  result = translation_pipeline(text)
17
  return result[0]['translation_text']