LabelManager.py 581 B

1234567891011121314151617181920
  1. from glob import glob
  2. from json import load
  3. from os import path
  4. from pycs import ApplicationStatus
  5. class LabelManager:
  6. def __init__(self, app_status: ApplicationStatus):
  7. # TODO create models folder if it does not exist
  8. # find labels
  9. for folder in glob('labels/*'):
  10. # load configuration.json
  11. with open(path.join(folder, 'configuration.json'), 'r') as file:
  12. label = load(file)
  13. label['path'] = folder
  14. label_id = label['id']
  15. app_status['labels'][label_id] = label