gokilashree commited on
Commit
4c52a34
·
verified ·
1 Parent(s): 8584983

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -0
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
+