File size: 1,758 Bytes
a2b9291 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
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.")
|