Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 9d44fadf authored by Robin Tissot's avatar Robin Tissot
Browse files

Merge branch 'fix/create-models-directory-with-parents' into 'develop'

Create .../models/\d+ with parents, preventing an error message at start of training

See merge request !75
parents b4eb608f e6a07a51
No related branches found
No related tags found
1 merge request!75Create .../models/\d+ with parents, preventing an error message at start of training
......@@ -3,6 +3,7 @@ import json
import logging
import numpy as np
import os.path
import pathlib
import shutil
from itertools import groupby
......@@ -352,8 +353,7 @@ def train_(qs, document, transcription, model=None, user=None):
filename = slugify(model.name) + '.mlmodel'
upload_to = model.file.field.upload_to(model, filename)
fulldir = os.path.join(settings.MEDIA_ROOT, os.path.split(upload_to)[0], '')
if not os.path.exists(fulldir):
os.mkdir(fulldir)
pathlib.Path(fulldir).mkdir(parents=True, exist_ok=True)
modelpath = os.path.join(fulldir, filename)
model.file = upload_to
model.save()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment