lang03383 commited on
Commit
a2b9291
1 Parent(s): 5a03722

Create wedgets_en.py

Browse files
Files changed (1) hide show
  1. sd_yun/wedgets_en.py +56 -0
sd_yun/wedgets_en.py ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import json
3
+ import time
4
+
5
+ # Setup Env
6
+ env = os.getenv('ENV_NAME')
7
+ root_path = os.getenv('ROOT_PATH')
8
+ webui_path = os.getenv('WEBUI_PATH')
9
+ free_plan = os.getenv('FREE_PLAN')
10
+
11
+ # Load Settings from JSON file
12
+ SETTINGS_FILE = f'{root_path}/settings.json'
13
+
14
+ def load_settings():
15
+ if os.path.exists(SETTINGS_FILE):
16
+ with open(SETTINGS_FILE, 'r') as f:
17
+ return json.load(f)
18
+ else:
19
+ raise FileNotFoundError(f"Settings file {SETTINGS_FILE} not found.")
20
+
21
+ settings = load_settings()
22
+
23
+ # Access the settings values directly from the `settings` dictionary
24
+ model = settings['model']
25
+ model_num = settings['model_num']
26
+ inpainting_model = settings['inpainting_model']
27
+ vae = settings['vae']
28
+ vae_num = settings['vae_num']
29
+ latest_webui = settings['latest_webui']
30
+ latest_exstensions = settings['latest_exstensions']
31
+ change_webui = settings['change_webui']
32
+ detailed_download = settings['detailed_download']
33
+ controlnet = settings['controlnet']
34
+ controlnet_num = settings['controlnet_num']
35
+ commit_hash = settings['commit_hash']
36
+ huggingface_token = settings['huggingface_token']
37
+ ngrok_token = settings['ngrok_token']
38
+ zrok_token = settings['zrok_token']
39
+ commandline_arguments = settings['commandline_arguments']
40
+ Model_url = settings['Model_url']
41
+ Vae_url = settings['Vae_url']
42
+ LoRA_url = settings['LoRA_url']
43
+ Embedding_url = settings['Embedding_url']
44
+ Extensions_url = settings['Extensions_url']
45
+ custom_file_urls = settings['custom_file_urls']
46
+
47
+ # Example function: Setup WebUI based on the loaded settings
48
+ def setup_webui():
49
+ UI = os.getenv('SDW_UI', change_webui)
50
+ if UI != change_webui:
51
+ os.environ['SDW_UI'] = change_webui
52
+
53
+ setup_webui()
54
+
55
+ # Main logic that depends on the settings
56
+ # print("Settings loaded and applied successfully.")