in src/save_models.py [0:0]
def read_models_from_os(dirname):
"""
Reads a list of models from a specified directory
"""
# Setup path string
base_dir = os.path.dirname(__file__)[:-4] # we use -4 to take off the src/ from the end to go back a directory
results_dir = os.path.join(base_dir, f'{dirname}/Models/')
if not os.path.isdir(results_dir):
raise Exception('Specified directory not found.')
models = []
for model in os.scandir(results_dir):
if model.is_file():
models.append(load(model))
return models