diff --git a/load_config.py b/load_config.py index 9ea2f5b..9398731 100644 --- a/load_config.py +++ b/load_config.py @@ -20,12 +20,20 @@ import json import os -CONFIG_PATH = os.path.join(os.path.dirname(__file__), 'config_template.json') +TEMPLATE_PATH = os.path.join(os.path.dirname(__file__), 'config_template.json') +CONFIG_PATH = os.path.join(os.path.dirname(__file__), 'config.json') def load_config(config_path=CONFIG_PATH): """Load the configuration JSON file.""" + + #Fallback to template if config.json doesn't exist + if not os.path.exists(config_path): + config_path = TEMPLATE_PATH + with open(config_path, 'r') as f: - return json.load(f) + config = json.load(f) + + return config def get_image_path(config, index=0): """Get the full path to an image file by index."""