MohamedUgas commited on
Commit
fd34562
1 Parent(s): d6ff673

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -5
app.py CHANGED
@@ -1,13 +1,10 @@
1
  import gradio as gr
2
  from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, pipeline
3
  import torch
4
- from ui import title, description, examples
5
- #from langs import LANGS
6
 
7
  model = AutoModelForSeq2SeqLM.from_pretrained("facebook/nllb-200-distilled-600M")
8
  tokenizer = AutoTokenizer.from_pretrained("facebook/nllb-200-distilled-600M")
9
 
10
- device = 0 if torch.cuda.is_available() else -1
11
 
12
  src_lang = 'som_Latn'
13
  tgt_lang = "eng_Latn"
@@ -17,8 +14,7 @@ def translate(text):
17
  model=model,
18
  tokenizer=tokenizer,
19
  src_lang=src_lang,
20
- tgt_lang=tgt_lang,
21
- device=device)
22
 
23
  result = translation_pipeline(text)
24
  return result[0]['translation_text']
 
1
  import gradio as gr
2
  from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, pipeline
3
  import torch
 
 
4
 
5
  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"
 
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']