Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -51,8 +51,8 @@ dict_map = {
|
|
51 |
"ỤY": "UỴ",
|
52 |
}
|
53 |
|
54 |
-
tokenizer_vi2en = AutoTokenizer.from_pretrained("vinai/vinai-translate-vi2en", src_lang="vi_VN")
|
55 |
-
model_vi2en = AutoModelForSeq2SeqLM.from_pretrained("vinai/vinai-translate-vi2en")
|
56 |
|
57 |
def translate_vi2en(vi_text: str) -> str:
|
58 |
for i, j in dict_map.items():
|
@@ -74,8 +74,8 @@ def translate_vi2en(vi_text: str) -> str:
|
|
74 |
en_text = " ".join(en_text)
|
75 |
return en_text
|
76 |
|
77 |
-
tokenizer_en2vi = AutoTokenizer.from_pretrained("vinai/vinai-translate-en2vi", src_lang="en_XX")
|
78 |
-
model_en2vi = AutoModelForSeq2SeqLM.from_pretrained("vinai/vinai-translate-en2vi")
|
79 |
|
80 |
def translate_en2vi(en_text: str) -> str:
|
81 |
input_ids = tokenizer_en2vi(en_text, return_tensors="pt").input_ids
|
|
|
51 |
"ỤY": "UỴ",
|
52 |
}
|
53 |
|
54 |
+
tokenizer_vi2en = AutoTokenizer.from_pretrained("vinai/vinai-translate-vi2en-v2", src_lang="vi_VN")
|
55 |
+
model_vi2en = AutoModelForSeq2SeqLM.from_pretrained("vinai/vinai-translate-vi2en-v2")
|
56 |
|
57 |
def translate_vi2en(vi_text: str) -> str:
|
58 |
for i, j in dict_map.items():
|
|
|
74 |
en_text = " ".join(en_text)
|
75 |
return en_text
|
76 |
|
77 |
+
tokenizer_en2vi = AutoTokenizer.from_pretrained("vinai/vinai-translate-en2vi-v2", src_lang="en_XX")
|
78 |
+
model_en2vi = AutoModelForSeq2SeqLM.from_pretrained("vinai/vinai-translate-en2vi-v2")
|
79 |
|
80 |
def translate_en2vi(en_text: str) -> str:
|
81 |
input_ids = tokenizer_en2vi(en_text, return_tensors="pt").input_ids
|