XufengDuan commited on
Commit
51b58f9
1 Parent(s): 2579411

update scripts

Browse files
Files changed (1) hide show
  1. src/backend/model_operations.py +8 -2
src/backend/model_operations.py CHANGED
@@ -41,8 +41,14 @@ logging.basicConfig(level=logging.INFO,
41
  format='%(asctime)s - %(levelname)s - %(message)s')
42
 
43
  # Load spacy model for word tokenization
44
- nlp = spacy.load("en_core_web_sm")
45
- nlp1 = spacy.load("en_core_web_trf")
 
 
 
 
 
 
46
  # os.environ["HUGGINGFACE_API_KEY"] = envs.TOKEN
47
 
48
  def load_evaluation_model(model_path):
 
41
  format='%(asctime)s - %(levelname)s - %(message)s')
42
 
43
  # Load spacy model for word tokenization
44
+ # nlp = spacy.load("en_core_web_sm")
45
+ try:
46
+ nlp1 = spacy.load("en_core_web_trf")
47
+ except OSError:
48
+ print("Downloading language model for the spaCy 'en_core_web_sm'...")
49
+ spacy.cli.download("en_core_web_trf")
50
+ nlp = spacy.load("en_core_web_trf")
51
+
52
  # os.environ["HUGGINGFACE_API_KEY"] = envs.TOKEN
53
 
54
  def load_evaluation_model(model_path):