Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
import gradio as gr
|
2 |
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
|
3 |
|
4 |
-
# Load the model and tokenizer
|
5 |
-
model_name = "
|
6 |
-
model =
|
7 |
-
tokenizer =
|
8 |
|
9 |
# Prediction function
|
10 |
def translate_text(input_text):
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
|
3 |
|
4 |
+
# Load the mBART model and tokenizer for multilingual translation
|
5 |
+
model_name = "facebook/mbart-large-50-many-to-many-mmt"
|
6 |
+
model = MBartForConditionalGeneration.from_pretrained(model_name)
|
7 |
+
tokenizer = MBart50TokenizerFast.from_pretrained(model_name, src_lang="en_XX", tgt_lang="th_TH")
|
8 |
|
9 |
# Prediction function
|
10 |
def translate_text(input_text):
|