Merge pull request #1296 from cmdr2/beta

Beta
This commit is contained in:
cmdr2 2023-05-23 15:12:27 +05:30 committed by GitHub
commit e93a49134a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 28 additions and 9 deletions

View File

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

View File

@ -1,5 +1,6 @@
import os import os
import argparse import argparse
import sys
# The config file is in the same directory as this script # The config file is in the same directory as this script
config_directory = os.path.dirname(__file__) config_directory = os.path.dirname(__file__)
@ -21,16 +22,16 @@ if os.path.isfile(config_yaml):
try: try:
config = yaml.safe_load(configfile) config = yaml.safe_load(configfile)
except Exception as e: except Exception as e:
print(e) print(e, file=sys.stderr)
exit() config = {}
elif os.path.isfile(config_json): elif os.path.isfile(config_json):
import json import json
with open(config_json, 'r') as configfile: with open(config_json, 'r') as configfile:
try: try:
config = json.load(configfile) config = json.load(configfile)
except Exception as e: except Exception as e:
print(e) print(e, file=sys.stderr)
exit() config = {}
else: else:
config = {} config = {}

View File

@ -169,6 +169,22 @@ function loadSettings() {
} }
}) })
CURRENTLY_LOADING_SETTINGS = false CURRENTLY_LOADING_SETTINGS = false
} else if (localStorage.length < 2) {
// localStorage is too short for OldSettings
// So this is likely the first time Easy Diffusion is running.
// Initialize vram_usage_level based on the available VRAM
function initGPUProfile(event) {
if ( "detail" in event
&& "active" in event.detail
&& "cuda:0" in event.detail.active
&& event.detail.active["cuda:0"].mem_total <4.5 )
{
vramUsageLevelField.value = "low"
vramUsageLevelField.dispatchEvent(new Event("change"))
}
document.removeEventListener("system_info_update", initGPUProfile)
}
document.addEventListener("system_info_update", initGPUProfile)
} else { } else {
CURRENTLY_LOADING_SETTINGS = true CURRENTLY_LOADING_SETTINGS = true
tryLoadOldSettings() tryLoadOldSettings()

View File

@ -239,7 +239,7 @@ function setServerStatus(event) {
break break
} }
if (SD.serverState.devices) { if (SD.serverState.devices) {
setDeviceInfo(SD.serverState.devices) document.dispatchEvent(new CustomEvent("system_info_update", { detail: SD.serverState.devices}))
} }
} }

View File

@ -181,8 +181,8 @@ var PARAMETERS = [
{ {
id: "listen_to_network", id: "listen_to_network",
type: ParameterType.checkbox, type: ParameterType.checkbox,
label: "Make Stable Diffusion available on your network. Please restart the program after changing this.", label: "Make Stable Diffusion available on your network",
note: "Other devices on your network can access this web page", note: "Other devices on your network can access this web page. Please restart the program after changing this.",
icon: "fa-network-wired", icon: "fa-network-wired",
default: true, default: true,
saveInAppConfig: true, saveInAppConfig: true,
@ -586,7 +586,7 @@ async function getSystemInfo() {
$("#use_gpus").val(activeDeviceIds) $("#use_gpus").val(activeDeviceIds)
} }
setDeviceInfo(devices) document.dispatchEvent(new CustomEvent("system_info_update", { detail: devices}))
setHostInfo(res["hosts"]) setHostInfo(res["hosts"])
let force = false let force = false
if (res["enforce_output_dir"] !== undefined) { if (res["enforce_output_dir"] !== undefined) {
@ -657,3 +657,5 @@ saveSettingsBtn.addEventListener("click", function() {
saveSettingsBtn.classList.add("active") saveSettingsBtn.classList.add("active")
Promise.all([savePromise, asyncDelay(300)]).then(() => saveSettingsBtn.classList.remove("active")) Promise.all([savePromise, asyncDelay(300)]).then(() => saveSettingsBtn.classList.remove("active"))
}) })
document.addEventListener("system_info_update", (e) => setDeviceInfo(e.detail))