mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2024-11-22 16:23:28 +01:00
commit
e93a49134a
@ -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.96",
|
||||
"sdkit": "1.0.97",
|
||||
"stable-diffusion-sdkit": "2.1.4",
|
||||
"rich": "12.6.0",
|
||||
"uvicorn": "0.19.0",
|
||||
|
@ -1,5 +1,6 @@
|
||||
import os
|
||||
import argparse
|
||||
import sys
|
||||
|
||||
# The config file is in the same directory as this script
|
||||
config_directory = os.path.dirname(__file__)
|
||||
@ -21,16 +22,16 @@ if os.path.isfile(config_yaml):
|
||||
try:
|
||||
config = yaml.safe_load(configfile)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
exit()
|
||||
print(e, file=sys.stderr)
|
||||
config = {}
|
||||
elif os.path.isfile(config_json):
|
||||
import json
|
||||
with open(config_json, 'r') as configfile:
|
||||
try:
|
||||
config = json.load(configfile)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
exit()
|
||||
print(e, file=sys.stderr)
|
||||
config = {}
|
||||
else:
|
||||
config = {}
|
||||
|
||||
|
@ -169,6 +169,22 @@ function loadSettings() {
|
||||
}
|
||||
})
|
||||
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 {
|
||||
CURRENTLY_LOADING_SETTINGS = true
|
||||
tryLoadOldSettings()
|
||||
|
@ -239,7 +239,7 @@ function setServerStatus(event) {
|
||||
break
|
||||
}
|
||||
if (SD.serverState.devices) {
|
||||
setDeviceInfo(SD.serverState.devices)
|
||||
document.dispatchEvent(new CustomEvent("system_info_update", { detail: SD.serverState.devices}))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -181,8 +181,8 @@ var PARAMETERS = [
|
||||
{
|
||||
id: "listen_to_network",
|
||||
type: ParameterType.checkbox,
|
||||
label: "Make Stable Diffusion available on your network. Please restart the program after changing this.",
|
||||
note: "Other devices on your network can access this web page",
|
||||
label: "Make Stable Diffusion available on your network",
|
||||
note: "Other devices on your network can access this web page. Please restart the program after changing this.",
|
||||
icon: "fa-network-wired",
|
||||
default: true,
|
||||
saveInAppConfig: true,
|
||||
@ -586,7 +586,7 @@ async function getSystemInfo() {
|
||||
$("#use_gpus").val(activeDeviceIds)
|
||||
}
|
||||
|
||||
setDeviceInfo(devices)
|
||||
document.dispatchEvent(new CustomEvent("system_info_update", { detail: devices}))
|
||||
setHostInfo(res["hosts"])
|
||||
let force = false
|
||||
if (res["enforce_output_dir"] !== undefined) {
|
||||
@ -657,3 +657,5 @@ saveSettingsBtn.addEventListener("click", function() {
|
||||
saveSettingsBtn.classList.add("active")
|
||||
Promise.all([savePromise, asyncDelay(300)]).then(() => saveSettingsBtn.classList.remove("active"))
|
||||
})
|
||||
|
||||
document.addEventListener("system_info_update", (e) => setDeviceInfo(e.detail))
|
||||
|
Loading…
Reference in New Issue
Block a user