datasetsANDmodels commited on
Commit
10fa466
·
verified ·
1 Parent(s): 4e3fcbf

Upload nllb.py

Browse files
Files changed (1) hide show
  1. nllb.py +26 -0
nllb.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import sys
2
+ import time
3
+
4
+ sr= sys.argv[1]
5
+ tr=sys.argv[2]
6
+ from transformers import pipeline
7
+ text= "I am callig from the tax office"
8
+ #text= "أنا من مكتب الضرائب"#ARB
9
+ #text="Sono di ufficio fiscale." #ITA
10
+ #text="Aku berhubung dari kantor pajak." #IND
11
+ #text="Soy un agente de impuestos."#SPA
12
+ #text="Tôi gọi từ văn phòng thuế"#VIE
13
+ #text="저는 세금청에서 왔습니다."#KOR
14
+
15
+ translator = pipeline(task="translation", model="nllb",src_lang=sr,tgt_lang=tr)
16
+ translation = translator(text)[0]['translation_text']
17
+ print(translation)
18
+
19
+
20
+ #arb_Arab
21
+ #eng_Latn
22
+ #ita_Latn
23
+ #ind_Latn
24
+ #spa_Latn
25
+ #vie_Latn
26
+ #kor_Hang