yaya-sy commited on
Commit
6fa74a8
1 Parent(s): 5e420cc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -11
app.py CHANGED
@@ -5,12 +5,8 @@ import time
5
  from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, pipeline
6
 
7
 
8
- def load_models():
9
- model = AutoModelForSeq2SeqLM.from_pretrained("facebook/nllb-200-distilled-1.3B")
10
- tokenizer = AutoTokenizer.from_pretrained("facebook/nllb-200-distilled-1.3B")
11
-
12
- return model, tokenizer
13
-
14
 
15
  def translation(source, target, text):
16
 
@@ -24,11 +20,6 @@ def translation(source, target, text):
24
 
25
 
26
  if __name__ == '__main__':
27
- print('\tinit models')
28
-
29
- model, tokenizer = load_models()
30
- global model
31
- global tokenizer
32
 
33
  # define gradio demo
34
  lang_codes = ["eng_Latn", "fuv_Latn", "fra_Latn", "arb_Arab"]
 
5
  from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, pipeline
6
 
7
 
8
+ model = AutoModelForSeq2SeqLM.from_pretrained("facebook/nllb-200-distilled-1.3B")
9
+ tokenizer = AutoTokenizer.from_pretrained("facebook/nllb-200-distilled-1.3B")
 
 
 
 
10
 
11
  def translation(source, target, text):
12
 
 
20
 
21
 
22
  if __name__ == '__main__':
 
 
 
 
 
23
 
24
  # define gradio demo
25
  lang_codes = ["eng_Latn", "fuv_Latn", "fra_Latn", "arb_Arab"]