MohamedUgas commited on
Commit
1f78c35
1 Parent(s): d5916a1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -6,15 +6,15 @@ model = AutoModelForSeq2SeqLM.from_pretrained("facebook/nllb-200-distilled-600M"
6
  tokenizer = AutoTokenizer.from_pretrained("facebook/nllb-200-distilled-600M")
7
 
8
 
9
- src_lang = 'som_Latn'
10
- tgt_lang = "eng_Latn"
11
 
12
- def translate(src_lang, tgt_lang, text):
13
  translation_pipeline = pipeline("translation",
14
  model=model,
15
  tokenizer=tokenizer,
16
- src_lang=src_lang,
17
- tgt_lang=tgt_lang)
18
 
19
  result = translation_pipeline(text)
20
  return result[0]['translation_text']
 
6
  tokenizer = AutoTokenizer.from_pretrained("facebook/nllb-200-distilled-600M")
7
 
8
 
9
+ source = 'som_Latn'
10
+ target = "eng_Latn"
11
 
12
+ def translate(source, target, text):
13
  translation_pipeline = pipeline("translation",
14
  model=model,
15
  tokenizer=tokenizer,
16
+ src_lang=source,
17
+ tgt_lang=target)
18
 
19
  result = translation_pipeline(text)
20
  return result[0]['translation_text']