kurianbenoy commited on
Commit
c6e8f66
·
1 Parent(s): 876cd0e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -4,15 +4,15 @@ from huggingface_hub import hf_hub_download
4
  from fastai.learner import load_learner
5
  from transformers import *
6
 
7
- pretrained_model_name = "Helsinki-NLP/opus-mt-en-ml"
8
- model_cls = AutoModelForSeq2SeqLM
9
- hf_arch, hf_config, hf_tokenizer, hf_model = BLURR.get_hf_objects(pretrained_model_name, model_cls=model_cls)
 
10
 
11
- model = load_learner(
12
- hf_hub_download("kurianbenoy/kde_en_ml_translation_model", "saved_model.pkl")
13
- )
14
 
15
  def translate_text(text):
 
16
  outputs = model.blurr_translate(text)
17
  return outputs[0]["translation_texts"]
18
 
 
4
  from fastai.learner import load_learner
5
  from transformers import *
6
 
7
+ def download():
8
+ pretrained_model_name = "Helsinki-NLP/opus-mt-en-ml"
9
+ model_cls = AutoModelForSeq2SeqLM
10
+ hf_arch, hf_config, hf_tokenizer, hf_model = BLURR.get_hf_objects(pretrained_model_name, model_cls=model_cls)
11
 
12
+ model = load_learner(hf_hub_download("kurianbenoy/kde_en_ml_translation_model", "saved_model.pkl"))
 
 
13
 
14
  def translate_text(text):
15
+ download()
16
  outputs = model.blurr_translate(text)
17
  return outputs[0]["translation_texts"]
18