WHY IS THERE A PART IN KAGGLE THAT DOESN'T FIT TOGETHER?!
Browse files
files_cells/python/ru/widgets_ru.py
CHANGED
@@ -499,37 +499,29 @@ save_button = widgets.Button(description='Сохранить').add_class("button
|
|
499 |
display(save_button)
|
500 |
|
501 |
|
502 |
-
# ============ Load / Save - Settings
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
"Vae": ['Vae', 'Vae_Num'],
|
514 |
-
"Additional": ['latest_webui', 'latest_exstensions', 'detailed_download', 'controlnet', 'controlnet_Num', 'commit_hash', 'optional_huggingface_token', 'ngrok_token', 'commandline_arguments'],
|
515 |
-
"CustomUrl": ['Model_url', 'Vae_url', 'LoRA_url', 'Embedding_url', 'Extensions_url', 'custom_file_urls']
|
516 |
-
}
|
517 |
|
518 |
def save_settings():
|
519 |
-
settings = {}
|
520 |
-
for section, keys in settings_structure.items():
|
521 |
-
settings[section] = {key: globals()[f"{key}_widget"].value for key in keys}
|
522 |
with open(SETTINGS_FILE, 'w') as f:
|
523 |
-
|
524 |
|
525 |
def load_settings():
|
526 |
if os.path.exists(SETTINGS_FILE):
|
527 |
with open(SETTINGS_FILE, 'r') as f:
|
528 |
-
|
529 |
-
for
|
530 |
-
|
531 |
-
if key in loaded_settings[section]:
|
532 |
-
globals()[f"{key}_widget"].value = loaded_settings[section][key]
|
533 |
|
534 |
def save_data(button):
|
535 |
save_settings()
|
|
|
499 |
display(save_button)
|
500 |
|
501 |
|
502 |
+
# ============ Load / Save - Settings V2 ============
|
503 |
+
SETTINGS_FILE = f'{root_path}/settings.json'
|
504 |
+
|
505 |
+
settings_keys = [
|
506 |
+
'Model', 'Model_Num', 'Inpainting_Model',
|
507 |
+
'Vae', 'Vae_Num',
|
508 |
+
'latest_webui', 'latest_exstensions', 'detailed_download',
|
509 |
+
'controlnet', 'controlnet_Num', 'commit_hash', 'optional_huggingface_token',
|
510 |
+
'ngrok_token', 'commandline_arguments',
|
511 |
+
'Model_url', 'Vae_url', 'LoRA_url', 'Embedding_url', 'Extensions_url', 'custom_file_urls'
|
512 |
+
]
|
|
|
|
|
|
|
|
|
513 |
|
514 |
def save_settings():
|
515 |
+
settings = {key: globals()[f"{key}_widget"].value for key in settings_keys}
|
|
|
|
|
516 |
with open(SETTINGS_FILE, 'w') as f:
|
517 |
+
json.dump(settings, f)
|
518 |
|
519 |
def load_settings():
|
520 |
if os.path.exists(SETTINGS_FILE):
|
521 |
with open(SETTINGS_FILE, 'r') as f:
|
522 |
+
settings = json.load(f)
|
523 |
+
for key in settings_keys:
|
524 |
+
globals()[f"{key}_widget"].value = settings.get(key)
|
|
|
|
|
525 |
|
526 |
def save_data(button):
|
527 |
save_settings()
|