Merge branch 'beta' into textualinv

This commit is contained in:
JeLuF 2023-06-30 09:01:34 +02:00
commit f09c50ec90
11 changed files with 36 additions and 21 deletions

View File

@ -18,7 +18,7 @@ os_name = platform.system()
modules_to_check = {
"torch": ("1.11.0", "1.13.1", "2.0.0"),
"torchvision": ("0.12.0", "0.14.1", "0.15.1"),
"sdkit": "1.0.112",
"sdkit": "1.0.115",
"stable-diffusion-sdkit": "2.1.4",
"rich": "12.6.0",
"uvicorn": "0.19.0",

View File

@ -17,10 +17,11 @@ args = parser.parse_args()
if os.path.isfile(config_yaml):
import yaml
from ruamel.yaml import YAML
yaml = YAML(typ='safe')
with open(config_yaml, 'r') as configfile:
try:
config = yaml.safe_load(configfile)
config = yaml.load(configfile)
except Exception as e:
print(e, file=sys.stderr)
config = {}

View File

@ -68,6 +68,7 @@ if "%update_branch%"=="" (
@copy sd-ui-files\scripts\on_sd_start.bat scripts\ /Y
@copy sd-ui-files\scripts\check_modules.py scripts\ /Y
@copy sd-ui-files\scripts\get_config.py scripts\ /Y
@copy sd-ui-files\scripts\config.yaml.sample scripts\ /Y
@copy "sd-ui-files\scripts\Start Stable Diffusion UI.cmd" . /Y
@copy "sd-ui-files\scripts\Developer Console.cmd" . /Y

View File

@ -51,6 +51,7 @@ cp sd-ui-files/scripts/on_sd_start.sh scripts/
cp sd-ui-files/scripts/bootstrap.sh scripts/
cp sd-ui-files/scripts/check_modules.py scripts/
cp sd-ui-files/scripts/get_config.py scripts/
cp sd-ui-files/scripts/config.yaml.sample scripts/
cp sd-ui-files/scripts/start.sh .
cp sd-ui-files/scripts/developer_console.sh .
cp sd-ui-files/scripts/functions.sh scripts/

View File

@ -6,6 +6,7 @@
@copy sd-ui-files\scripts\on_env_start.bat scripts\ /Y
@copy sd-ui-files\scripts\check_modules.py scripts\ /Y
@copy sd-ui-files\scripts\get_config.py scripts\ /Y
@copy sd-ui-files\scripts\config.yaml.sample scripts\ /Y
if exist "%cd%\profile" (
set HF_HOME=%cd%\profile\.cache\huggingface

View File

@ -5,6 +5,7 @@ cp sd-ui-files/scripts/on_env_start.sh scripts/
cp sd-ui-files/scripts/bootstrap.sh scripts/
cp sd-ui-files/scripts/check_modules.py scripts/
cp sd-ui-files/scripts/get_config.py scripts/
cp sd-ui-files/scripts/config.yaml.sample scripts/
source ./scripts/functions.sh

View File

@ -1,6 +1,7 @@
import json
import logging
import os
import shutil
import socket
import sys
import traceback
@ -17,8 +18,6 @@ from rich.console import Console
from rich.panel import Panel
from sdkit.utils import log as sdkit_log # hack, so we can overwrite the log config
yaml = YAML()
# Remove all handlers associated with the root logger object.
for handler in logging.root.handlers[:]:
logging.root.removeHandler(handler)
@ -106,6 +105,7 @@ def getConfig(default_val=APP_CONFIG_DEFAULTS):
config_yaml_path = os.path.join(CONFIG_DIR, "config.yaml")
if os.path.isfile(config_yaml_path):
try:
yaml = YAML()
with open(config_yaml_path, "r", encoding="utf-8") as f:
config = yaml.load(f)
if "net" not in config:
@ -127,15 +127,15 @@ def getConfig(default_val=APP_CONFIG_DEFAULTS):
config_json_path = os.path.join(CONFIG_DIR, "config.json")
if not os.path.exists(config_json_path):
return default_val
else:
log.info("Converting old json config file to yaml")
with open(config_json_path, "r", encoding="utf-8") as f:
config = json.load(f)
# Save config in new format
setConfig(config)
os.rename(config_json_path, config_json_path + ".bak")
log.info("Saved old config.json as config.json.bak")
return getConfig(default_val)
log.info("Converting old json config file to yaml")
with open(config_json_path, "r", encoding="utf-8") as f:
config = json.load(f)
# Save config in new format
setConfig(config)
shutil.move(config_json_path, config_json_path + ".bak")
log.info("Saved old config.json as config.json.bak")
return getConfig(default_val)
except Exception as e:
log.warn(traceback.format_exc())
return default_val
@ -144,6 +144,19 @@ def getConfig(default_val=APP_CONFIG_DEFAULTS):
def setConfig(config):
try: # config.yaml
config_yaml_path = os.path.join(CONFIG_DIR, "config.yaml")
yaml = YAML()
if not hasattr(config, "_yaml_comment"):
config_yaml_sample_path = os.path.join(CONFIG_DIR, "config.yaml.sample")
if os.path.exists(config_yaml_sample_path):
with open(config_yaml_sample_path, "r", encoding="utf-8") as f:
commented_config = yaml.load(f)
for k in config:
commented_config[k] = config[k]
config = commented_config
yaml.indent(mapping=2, sequence=4, offset=2)
with open(config_yaml_path, "w", encoding="utf-8") as f:
yaml.dump(config, f)

View File

@ -78,7 +78,7 @@
<div id="init_image_preview_container" class="image_preview_container">
<div id="init_image_wrapper">
<img id="init_image_preview" src="" />
<img id="init_image_preview" src="" crossorigin="anonymous" />
<span id="init_image_size_box" class="img_bottom_label"></span>
<button class="init_image_clear image_clear_btn"><i class="fa-solid fa-xmark"></i></button>
</div>

View File

@ -12,6 +12,7 @@ body {
font-size: 11pt;
background-color: var(--background-color1);
color: var(--text-color);
overscroll-behavior-y: contain;
}
a {
color: var(--link-color);

View File

@ -159,17 +159,13 @@
transform: scale(0.95);
box-shadow: 0 5px 16px 5px rgba(0, 0, 0, 0.5);
}
#preview-image {
margin-top: 0.5em;
margin-bottom: 0.5em;
}
.modifier-card-active {
border: 2px solid rgb(179 82 255 / 94%);
box-shadow: 0 0px 10px 0 rgb(170 0 229 / 58%);
}
#modifier-card-size-slider {
width: 6em;
margin-bottom: 0.5em;
height: 4pt;
vertical-align: middle;
}
#modifier-settings-config textarea {

View File

@ -363,7 +363,7 @@ function changePreviewImages(val) {
preview = previews.landscape
}
if (preview != null) {
if (preview) {
previewImage.src = `${modifierThumbnailPath}/${preview}`
previewImage.setAttribute("preview-type", val)
}