khrek commited on
Commit
5313aae
1 Parent(s): 9be7e3f

Update models.py

Browse files
Files changed (1) hide show
  1. models.py +3 -2
models.py CHANGED
@@ -17,10 +17,11 @@ class Models():
17
  self.ner = pipeline('ner', model=model, tokenizer=tokenizer, aggregation_strategy="simple")
18
  current_directory = os.path.dirname(os.path.realpath(__file__))
19
  custom_ner_path = os.path.join(current_directory, 'spacy_model_v2/output/model-best')
 
20
  if not os.path.exists(custom_ner_path):
21
- with zipfile.ZipFile(r"models\prototype\spacy_model_v2.zip", 'r') as zip_ref:
22
  # Extract all contents in the current working directory
23
- zip_ref.extractall()
24
  self.custom_ner = spacy.load(custom_ner_path)
25
 
26
  def extract_ner(self, text):
 
17
  self.ner = pipeline('ner', model=model, tokenizer=tokenizer, aggregation_strategy="simple")
18
  current_directory = os.path.dirname(os.path.realpath(__file__))
19
  custom_ner_path = os.path.join(current_directory, 'spacy_model_v2/output/model-best')
20
+ destination_folder = "/spacy_model_v2"
21
  if not os.path.exists(custom_ner_path):
22
+ with zipfile.ZipFile(r"./spacy_model_v2.zip", 'r') as zip_ref:
23
  # Extract all contents in the current working directory
24
+ zip_ref.extractall(current_directory+destination_folder)
25
  self.custom_ner = spacy.load(custom_ner_path)
26
 
27
  def extract_ner(self, text):