Spaces:
Runtime error
Runtime error
gokilashree
commited on
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import MBartForConditionalGeneration, MBart50Tokenizer
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
# Load mBART model and tokenizer for multilingual translation
|
5 |
+
model_name = 'facebook/mbart-large-50-many-to-one-mmt' # mBART 50 for many-to-one translation (many languages to English)
|
6 |
+
tokenizer = MBart50Tokenizer.from_pretrained(model_name)
|
7 |
+
model = MBartForConditionalGeneration.from_pretrained(model_name)
|
8 |
+
|
9 |
+
# Set the source language code (Tamil)
|
10 |
+
tokenizer.src_lang = "ta_IN" # Tamil language code
|
11 |
+
…interface.launch()
|
12 |
+
|