forked from extern/easydiffusion
Merge pull request #1397 from ogmaresca/restart-needed
Add Restart needed to diffusers-only fields if you enable diffusers then refresh without restarting EasyDiffusion
This commit is contained in:
commit
e358a72925
@ -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_config_on_startup(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_config_on_startup(config)
|
||||
|
||||
return config
|
||||
except Exception as e:
|
||||
log.warn(traceback.format_exc())
|
||||
set_config_on_startup(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_config_on_startup(default_val)
|
||||
return default_val
|
||||
|
||||
getConfig.__config_on_startup = None
|
||||
|
||||
|
||||
def setConfig(config):
|
||||
try: # config.yaml
|
||||
|
@ -142,7 +142,7 @@
|
||||
</td></tr>
|
||||
<tr class="pl-5 displayNone" id="clip_skip_config">
|
||||
<td><label for="clip_skip">Clip Skip:</label></td>
|
||||
<td>
|
||||
<td class="diffusers-restart-needed">
|
||||
<input id="clip_skip" name="clip_skip" type="checkbox">
|
||||
<a href="https://github.com/easydiffusion/easydiffusion/wiki/Clip-Skip" target="_blank"><i class="fa-solid fa-circle-question help-btn"><span class="simple-tooltip top-left">Click to learn more about Clip Skip</span></i></a>
|
||||
</td>
|
||||
@ -232,7 +232,7 @@
|
||||
<td>
|
||||
<label for="lora_model">LoRA:</label>
|
||||
</td>
|
||||
<td>
|
||||
<td class="diffusers-restart-needed">
|
||||
<div class="model_entries"></div>
|
||||
<button class="add_model_entry"><i class="fa-solid fa-plus"></i> add another LoRA</button>
|
||||
</td>
|
||||
@ -244,18 +244,24 @@
|
||||
<td><label for="hypernetwork_strength_slider">Hypernetwork Strength:</label></td>
|
||||
<td> <input id="hypernetwork_strength_slider" name="hypernetwork_strength_slider" class="editor-slider" value="100" type="range" min="0" max="100"> <input id="hypernetwork_strength" name="hypernetwork_strength" size="4" pattern="^[0-9\.]+$" onkeypress="preventNonNumericalInput(event)"><br/></td>
|
||||
</tr>
|
||||
<tr id="embeddings-container" class="pl-5 displayNone"><td><label for="embeddings-button">Embedding:</label></td><td>
|
||||
<button id="embeddings-button" class="tertiaryButton">Add embedding to prompt</button>
|
||||
</td></tr>
|
||||
<tr id="tiling_container" class="pl-5"><td><label for="tiling">Seamless Tiling:</label></td><td>
|
||||
<select id="tiling" name="tiling">
|
||||
<option value="none" selected>None</option>
|
||||
<option value="x">Horizontal</option>
|
||||
<option value="y">Vertical</option>
|
||||
<option value="xy">Both</option>
|
||||
</select>
|
||||
<a href="https://github.com/easydiffusion/easydiffusion/wiki/Seamless-Tiling" target="_blank"><i class="fa-solid fa-circle-question help-btn"><span class="simple-tooltip top-left">Click to learn more about Seamless Tiling</span></i></a>
|
||||
</td></tr>
|
||||
<tr id="embeddings-container" class="pl-5 displayNone">
|
||||
<td><label for="embeddings-button">Embedding:</label></td>
|
||||
<td class="diffusers-restart-needed">
|
||||
<button id="embeddings-button" class="tertiaryButton">Add embedding to prompt</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="tiling_container" class="pl-5">
|
||||
<td><label for="tiling">Seamless Tiling:</label></td>
|
||||
<td class="diffusers-restart-needed">
|
||||
<select id="tiling" name="tiling">
|
||||
<option value="none" selected>None</option>
|
||||
<option value="x">Horizontal</option>
|
||||
<option value="y">Vertical</option>
|
||||
<option value="xy">Both</option>
|
||||
</select>
|
||||
<a href="https://github.com/easydiffusion/easydiffusion/wiki/Seamless-Tiling" target="_blank"><i class="fa-solid fa-circle-question help-btn"><span class="simple-tooltip top-left">Click to learn more about Seamless Tiling</span></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="pl-5"><td><label for="output_format">Output Format:</label></td><td>
|
||||
<select id="output_format" name="output_format">
|
||||
<option value="jpeg" selected>jpeg</option>
|
||||
|
@ -1685,4 +1685,17 @@ body.wait-pause {
|
||||
|
||||
.model_entry .model_name {
|
||||
width: 65%;
|
||||
}
|
||||
}
|
||||
|
||||
.diffusers-disabled-on-startup .diffusers-restart-needed {
|
||||
font-size: 0;
|
||||
}
|
||||
|
||||
.diffusers-disabled-on-startup .diffusers-restart-needed * {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.diffusers-disabled-on-startup .diffusers-restart-needed::after {
|
||||
content: "Restart needed";
|
||||
font-size: 10pt;
|
||||
}
|
||||
|
@ -424,6 +424,16 @@ async function getAppConfig() {
|
||||
const testDiffusersEnabled = config.test_diffusers && config.update_branch !== "main"
|
||||
testDiffusers.checked = testDiffusersEnabled
|
||||
|
||||
if (config.config_on_startup) {
|
||||
if (config.config_on_startup?.test_diffusers && config.update_branch !== "main") {
|
||||
document.body.classList.add("diffusers-enabled-on-startup");
|
||||
document.body.classList.remove("diffusers-disabled-on-startup");
|
||||
} else {
|
||||
document.body.classList.add("diffusers-disabled-on-startup");
|
||||
document.body.classList.remove("diffusers-enabled-on-startup");
|
||||
}
|
||||
}
|
||||
|
||||
if (!testDiffusersEnabled) {
|
||||
document.querySelector("#lora_model_container").style.display = "none"
|
||||
document.querySelector("#tiling_container").style.display = "none"
|
||||
|
Loading…
Reference in New Issue
Block a user