Fix key error dict

parent d6a46bf8
Pipeline #3277 failed with stages
in 24 seconds
......@@ -40,8 +40,8 @@ class Worker(nlp_ws.NLPWorker):
self.config = configparser.ConfigParser()
self.config.read("config.ini")
self.config = self.config["deployment"]
self.languagetool_map = {'model_path_pl': 'pl-PL', 'model_path_ru':
'ru', 'model_path_en': 'en-US'}
self.languagetool_map = {self.config['model_path_pl']: 'pl-PL', self.config['model_path_ru']:
'ru', self.config['model_path_en']: 'en-US'}
self.max_context_size = int(self.config["max_context_size"])
self.overlap = int(self.config["overlap"])
......@@ -123,7 +123,7 @@ class Worker(nlp_ws.NLPWorker):
).to(device)
tokenizer = AutoTokenizer.from_pretrained(model_path)
mapping = {}
with open(f"{model_path}/classes.json", "r") as f:
with open(f"{self.config['model_path_pl']}/classes.json", "r") as f:
mapping = json.load(f)
mapping = list(mapping.keys())
return tool, model, tokenizer, mapping
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment