Spaces:
Runtime error
Runtime error
japanese-denim
commited on
Commit
•
39dc3ab
1
Parent(s):
59fd7cf
Update app.py
Browse files
app.py
CHANGED
@@ -2,8 +2,8 @@ from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, pipeline
|
|
2 |
import torch
|
3 |
|
4 |
model_checkpoint = "japanese-denim/mbart-50-finetuned-eng-to-naga"
|
5 |
-
model = AutoModelForSeq2SeqLM.from_pretrained(model_checkpoint)
|
6 |
-
tokenizer = AutoTokenizer.from_pretrained(model_checkpoint)
|
7 |
|
8 |
|
9 |
src_lang = 'en_XX'
|
@@ -12,8 +12,7 @@ tgt_lang = "ng_XX"
|
|
12 |
|
13 |
def translate(text):
|
14 |
translation_pipeline = pipeline("translation",
|
15 |
-
model=
|
16 |
-
tokenizer=tokenizer,
|
17 |
src_lang=src_lang,
|
18 |
tgt_lang=tgt_lang)
|
19 |
|
@@ -25,7 +24,7 @@ def translate(text):
|
|
25 |
gr.Interface(
|
26 |
translate,
|
27 |
[
|
28 |
-
gr.components.Textbox(label="input", placeholder = "
|
29 |
],
|
30 |
["text"],
|
31 |
).launch()
|
|
|
2 |
import torch
|
3 |
|
4 |
model_checkpoint = "japanese-denim/mbart-50-finetuned-eng-to-naga"
|
5 |
+
# model = AutoModelForSeq2SeqLM.from_pretrained(model_checkpoint)
|
6 |
+
# tokenizer = AutoTokenizer.from_pretrained(model_checkpoint)
|
7 |
|
8 |
|
9 |
src_lang = 'en_XX'
|
|
|
12 |
|
13 |
def translate(text):
|
14 |
translation_pipeline = pipeline("translation",
|
15 |
+
model=model_checkpoint,
|
|
|
16 |
src_lang=src_lang,
|
17 |
tgt_lang=tgt_lang)
|
18 |
|
|
|
24 |
gr.Interface(
|
25 |
translate,
|
26 |
[
|
27 |
+
gr.components.Textbox(label="input", placeholder = "Enter English sentence here")
|
28 |
],
|
29 |
["text"],
|
30 |
).launch()
|