1234567891011121314151617181920 |
- from glob import glob
- from json import load
- from os import path
- from pycs import ApplicationStatus
- class LabelManager:
- def __init__(self, app_status: ApplicationStatus):
- # TODO create models folder if it does not exist
- # find labels
- for folder in glob('labels/*'):
- # load configuration.json
- with open(path.join(folder, 'configuration.json'), 'r') as file:
- label = load(file)
- label['path'] = folder
- label_id = label['id']
- app_status['labels'][label_id] = label
|