From db55064bb218842a14773d17a96edddd417d2835 Mon Sep 17 00:00:00 2001 From: Olivia Godone-Maresca Date: Sun, 9 Jul 2023 16:54:25 -0400 Subject: [PATCH] Add Restart needed to diffusers-only fields if you enable diffusers then refresh without restarting EasyDiffusion --- ui/easydiffusion/app.py | 15 ++++++++++++-- ui/index.html | 43 +++++++++++++++++++++++---------------- ui/media/css/main.css | 13 ++++++++++++ ui/media/js/main.js | 5 ++++- ui/media/js/parameters.js | 12 ++++++++++- 5 files changed, 67 insertions(+), 21 deletions(-) diff --git a/ui/easydiffusion/app.py b/ui/easydiffusion/app.py index 8e317d83..40a9792f 100644 --- a/ui/easydiffusion/app.py +++ b/ui/easydiffusion/app.py @@ -5,7 +5,7 @@ import shutil import socket import sys import traceback -import shlex +import copy from ruamel.yaml import YAML import urllib @@ -102,7 +102,6 @@ def init_render_threads(): update_render_threads() - def getConfig(default_val=APP_CONFIG_DEFAULTS): config_yaml_path = os.path.join(CONFIG_DIR, "..", "config.yaml") @@ -111,6 +110,11 @@ def getConfig(default_val=APP_CONFIG_DEFAULTS): if os.path.isfile(config_legacy_yaml): shutil.move(config_legacy_yaml, config_yaml_path) + def set_default_config(config: dict): + if (getConfig.__config_on_startup is None): + getConfig.__config_on_startup = copy.deepcopy(config) + config["config_on_startup"] = getConfig.__config_on_startup + if os.path.isfile(config_yaml_path): try: yaml = YAML() @@ -126,9 +130,13 @@ def getConfig(default_val=APP_CONFIG_DEFAULTS): config["net"]["listen_to_network"] = os.getenv("SD_UI_BIND_IP") == "0.0.0.0" else: config["net"]["listen_to_network"] = True + + set_default_config(config) + return config except Exception as e: log.warn(traceback.format_exc()) + set_default_config(default_val) return default_val else: try: @@ -149,8 +157,11 @@ def getConfig(default_val=APP_CONFIG_DEFAULTS): return getConfig(default_val) except Exception as e: log.warn(traceback.format_exc()) + set_default_config(default_val) return default_val +getConfig.__config_on_startup = None + def setConfig(config): try: # config.yaml diff --git a/ui/index.html b/ui/index.html index 47b05240..1ebde256 100644 --- a/ui/index.html +++ b/ui/index.html @@ -142,7 +142,7 @@ - + Click to learn more about Clip Skip @@ -227,12 +227,15 @@
- - - + + + + + + - + -2 2  
@@ -244,18 +247,24 @@
- - - - - - Click to learn more about Seamless Tiling - + + + + + + + + + + + Click to learn more about Seamless Tiling + +