import os import json import time # Setup Env env = os.getenv('ENV_NAME') root_path = os.getenv('ROOT_PATH') webui_path = os.getenv('WEBUI_PATH') free_plan = os.getenv('FREE_PLAN') # Load Settings from JSON file SETTINGS_FILE = f'{root_path}/settings.json' def load_settings(): if os.path.exists(SETTINGS_FILE): with open(SETTINGS_FILE, 'r') as f: return json.load(f) else: raise FileNotFoundError(f"Settings file {SETTINGS_FILE} not found.") settings = load_settings() # Access the settings values directly from the `settings` dictionary model = settings['model'] model_num = settings['model_num'] inpainting_model = settings['inpainting_model'] vae = settings['vae'] vae_num = settings['vae_num'] latest_webui = settings['latest_webui'] latest_exstensions = settings['latest_exstensions'] change_webui = settings['change_webui'] detailed_download = settings['detailed_download'] controlnet = settings['controlnet'] controlnet_num = settings['controlnet_num'] commit_hash = settings['commit_hash'] huggingface_token = settings['huggingface_token'] ngrok_token = settings['ngrok_token'] zrok_token = settings['zrok_token'] commandline_arguments = settings['commandline_arguments'] Model_url = settings['Model_url'] Vae_url = settings['Vae_url'] LoRA_url = settings['LoRA_url'] Embedding_url = settings['Embedding_url'] Extensions_url = settings['Extensions_url'] custom_file_urls = settings['custom_file_urls'] # Example function: Setup WebUI based on the loaded settings def setup_webui(): UI = os.getenv('SDW_UI', change_webui) if UI != change_webui: os.environ['SDW_UI'] = change_webui setup_webui() # Main logic that depends on the settings # print("Settings loaded and applied successfully.")