mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2025-06-20 09:57:49 +02:00
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 socket
|
||||||
import sys
|
import sys
|
||||||
import traceback
|
import traceback
|
||||||
import shlex
|
import copy
|
||||||
from ruamel.yaml import YAML
|
from ruamel.yaml import YAML
|
||||||
|
|
||||||
import urllib
|
import urllib
|
||||||
@ -102,7 +102,6 @@ def init_render_threads():
|
|||||||
|
|
||||||
update_render_threads()
|
update_render_threads()
|
||||||
|
|
||||||
|
|
||||||
def getConfig(default_val=APP_CONFIG_DEFAULTS):
|
def getConfig(default_val=APP_CONFIG_DEFAULTS):
|
||||||
config_yaml_path = os.path.join(CONFIG_DIR, "..", "config.yaml")
|
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):
|
if os.path.isfile(config_legacy_yaml):
|
||||||
shutil.move(config_legacy_yaml, config_yaml_path)
|
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):
|
if os.path.isfile(config_yaml_path):
|
||||||
try:
|
try:
|
||||||
yaml = YAML()
|
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"
|
config["net"]["listen_to_network"] = os.getenv("SD_UI_BIND_IP") == "0.0.0.0"
|
||||||
else:
|
else:
|
||||||
config["net"]["listen_to_network"] = True
|
config["net"]["listen_to_network"] = True
|
||||||
|
|
||||||
|
set_config_on_startup(config)
|
||||||
|
|
||||||
return config
|
return config
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.warn(traceback.format_exc())
|
log.warn(traceback.format_exc())
|
||||||
|
set_config_on_startup(default_val)
|
||||||
return default_val
|
return default_val
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
@ -149,8 +157,11 @@ def getConfig(default_val=APP_CONFIG_DEFAULTS):
|
|||||||
return getConfig(default_val)
|
return getConfig(default_val)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.warn(traceback.format_exc())
|
log.warn(traceback.format_exc())
|
||||||
|
set_config_on_startup(default_val)
|
||||||
return default_val
|
return default_val
|
||||||
|
|
||||||
|
getConfig.__config_on_startup = None
|
||||||
|
|
||||||
|
|
||||||
def setConfig(config):
|
def setConfig(config):
|
||||||
try: # config.yaml
|
try: # config.yaml
|
||||||
|
@ -142,7 +142,7 @@
|
|||||||
</td></tr>
|
</td></tr>
|
||||||
<tr class="pl-5 displayNone" id="clip_skip_config">
|
<tr class="pl-5 displayNone" id="clip_skip_config">
|
||||||
<td><label for="clip_skip">Clip Skip:</label></td>
|
<td><label for="clip_skip">Clip Skip:</label></td>
|
||||||
<td>
|
<td class="diffusers-restart-needed">
|
||||||
<input id="clip_skip" name="clip_skip" type="checkbox">
|
<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>
|
<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>
|
</td>
|
||||||
@ -232,7 +232,7 @@
|
|||||||
<td>
|
<td>
|
||||||
<label for="lora_model">LoRA:</label>
|
<label for="lora_model">LoRA:</label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td class="diffusers-restart-needed">
|
||||||
<div class="model_entries"></div>
|
<div class="model_entries"></div>
|
||||||
<button class="add_model_entry"><i class="fa-solid fa-plus"></i> add another LoRA</button>
|
<button class="add_model_entry"><i class="fa-solid fa-plus"></i> add another LoRA</button>
|
||||||
</td>
|
</td>
|
||||||
@ -244,18 +244,24 @@
|
|||||||
<td><label for="hypernetwork_strength_slider">Hypernetwork Strength:</label></td>
|
<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>
|
<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>
|
||||||
<tr id="embeddings-container" class="pl-5 displayNone"><td><label for="embeddings-button">Embedding:</label></td><td>
|
<tr id="embeddings-container" class="pl-5 displayNone">
|
||||||
<button id="embeddings-button" class="tertiaryButton">Add embedding to prompt</button>
|
<td><label for="embeddings-button">Embedding:</label></td>
|
||||||
</td></tr>
|
<td class="diffusers-restart-needed">
|
||||||
<tr id="tiling_container" class="pl-5"><td><label for="tiling">Seamless Tiling:</label></td><td>
|
<button id="embeddings-button" class="tertiaryButton">Add embedding to prompt</button>
|
||||||
<select id="tiling" name="tiling">
|
</td>
|
||||||
<option value="none" selected>None</option>
|
</tr>
|
||||||
<option value="x">Horizontal</option>
|
<tr id="tiling_container" class="pl-5">
|
||||||
<option value="y">Vertical</option>
|
<td><label for="tiling">Seamless Tiling:</label></td>
|
||||||
<option value="xy">Both</option>
|
<td class="diffusers-restart-needed">
|
||||||
</select>
|
<select id="tiling" name="tiling">
|
||||||
<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>
|
<option value="none" selected>None</option>
|
||||||
</td></tr>
|
<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>
|
<tr class="pl-5"><td><label for="output_format">Output Format:</label></td><td>
|
||||||
<select id="output_format" name="output_format">
|
<select id="output_format" name="output_format">
|
||||||
<option value="jpeg" selected>jpeg</option>
|
<option value="jpeg" selected>jpeg</option>
|
||||||
|
@ -1685,4 +1685,17 @@ body.wait-pause {
|
|||||||
|
|
||||||
.model_entry .model_name {
|
.model_entry .model_name {
|
||||||
width: 65%;
|
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"
|
const testDiffusersEnabled = config.test_diffusers && config.update_branch !== "main"
|
||||||
testDiffusers.checked = testDiffusersEnabled
|
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) {
|
if (!testDiffusersEnabled) {
|
||||||
document.querySelector("#lora_model_container").style.display = "none"
|
document.querySelector("#lora_model_container").style.display = "none"
|
||||||
document.querySelector("#tiling_container").style.display = "none"
|
document.querySelector("#tiling_container").style.display = "none"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user