mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2025-06-21 10:27:47 +02:00
Merge branch 'beta' into bucketlite
This commit is contained in:
commit
2b49f6a8d0
@ -22,6 +22,7 @@
|
|||||||
Our focus continues to remain on an easy installation experience, and an easy user-interface. While still remaining pretty powerful, in terms of features and speed.
|
Our focus continues to remain on an easy installation experience, and an easy user-interface. While still remaining pretty powerful, in terms of features and speed.
|
||||||
|
|
||||||
### Detailed changelog
|
### Detailed changelog
|
||||||
|
* 2.5.48 - 1 Aug 2023 - (beta-only) Full support for ControlNets. You can select a control image to guide the AI. You can pick a filter to pre-process the image, and one of the known (or custom) controlnet models. Supports `OpenPose`, `Canny`, `Straight Lines`, `Depth`, `Line Art`, `Scribble`, `Soft Edge`, `Shuffle` and `Segment`.
|
||||||
* 2.5.47 - 30 Jul 2023 - An option to use `Strict Mask Border` while inpainting, to avoid touching areas outside the mask. But this might show a slight outline of the mask, which you will have to touch up separately.
|
* 2.5.47 - 30 Jul 2023 - An option to use `Strict Mask Border` while inpainting, to avoid touching areas outside the mask. But this might show a slight outline of the mask, which you will have to touch up separately.
|
||||||
* 2.5.47 - 29 Jul 2023 - (beta-only) Fix long prompts with SDXL.
|
* 2.5.47 - 29 Jul 2023 - (beta-only) Fix long prompts with SDXL.
|
||||||
* 2.5.47 - 29 Jul 2023 - (beta-only) Fix red dots in some SDXL images.
|
* 2.5.47 - 29 Jul 2023 - (beta-only) Fix red dots in some SDXL images.
|
||||||
|
@ -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.153",
|
"sdkit": "1.0.156",
|
||||||
"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",
|
||||||
|
@ -9,6 +9,7 @@ from easydiffusion.types import ModelsData
|
|||||||
from easydiffusion.utils import log
|
from easydiffusion.utils import log
|
||||||
from sdkit import Context
|
from sdkit import Context
|
||||||
from sdkit.models import load_model, scan_model, unload_model, download_model, get_model_info_from_db
|
from sdkit.models import load_model, scan_model, unload_model, download_model, get_model_info_from_db
|
||||||
|
from sdkit.models.model_loader.controlnet_filters import filters as cn_filters
|
||||||
from sdkit.utils import hash_file_quick
|
from sdkit.utils import hash_file_quick
|
||||||
|
|
||||||
KNOWN_MODEL_TYPES = [
|
KNOWN_MODEL_TYPES = [
|
||||||
@ -19,6 +20,8 @@ KNOWN_MODEL_TYPES = [
|
|||||||
"realesrgan",
|
"realesrgan",
|
||||||
"lora",
|
"lora",
|
||||||
"codeformer",
|
"codeformer",
|
||||||
|
"embeddings",
|
||||||
|
"controlnet",
|
||||||
]
|
]
|
||||||
MODEL_EXTENSIONS = {
|
MODEL_EXTENSIONS = {
|
||||||
"stable-diffusion": [".ckpt", ".safetensors"],
|
"stable-diffusion": [".ckpt", ".safetensors"],
|
||||||
@ -29,6 +32,7 @@ MODEL_EXTENSIONS = {
|
|||||||
"lora": [".ckpt", ".safetensors"],
|
"lora": [".ckpt", ".safetensors"],
|
||||||
"codeformer": [".pth"],
|
"codeformer": [".pth"],
|
||||||
"embeddings": [".pt", ".bin", ".safetensors"],
|
"embeddings": [".pt", ".bin", ".safetensors"],
|
||||||
|
"controlnet": [".pth", ".safetensors"],
|
||||||
}
|
}
|
||||||
DEFAULT_MODELS = {
|
DEFAULT_MODELS = {
|
||||||
"stable-diffusion": [
|
"stable-diffusion": [
|
||||||
@ -177,10 +181,17 @@ def reload_models_if_necessary(context: Context, models_data: ModelsData, models
|
|||||||
def resolve_model_paths(models_data: ModelsData):
|
def resolve_model_paths(models_data: ModelsData):
|
||||||
model_paths = models_data.model_paths
|
model_paths = models_data.model_paths
|
||||||
for model_type in model_paths:
|
for model_type in model_paths:
|
||||||
if model_type in ("latent_upscaler", "nsfw_checker"): # doesn't use model paths
|
skip_models = cn_filters + ["latent_upscaler", "nsfw_checker"]
|
||||||
|
if model_type in skip_models: # doesn't use model paths
|
||||||
continue
|
continue
|
||||||
if model_type == "codeformer":
|
if model_type == "codeformer":
|
||||||
download_if_necessary("codeformer", "codeformer.pth", "codeformer-0.1.0")
|
download_if_necessary("codeformer", "codeformer.pth", "codeformer-0.1.0")
|
||||||
|
elif model_type == "controlnet":
|
||||||
|
model_id = model_paths[model_type]
|
||||||
|
model_info = get_model_info_from_db(model_type=model_type, model_id=model_id)
|
||||||
|
if model_info:
|
||||||
|
filename = model_info.get("url", "").split("/")[-1]
|
||||||
|
download_if_necessary("controlnet", filename, model_id, skip_if_others_exist=False)
|
||||||
|
|
||||||
model_paths[model_type] = resolve_model_to_use(model_paths[model_type], model_type=model_type)
|
model_paths[model_type] = resolve_model_to_use(model_paths[model_type], model_type=model_type)
|
||||||
|
|
||||||
@ -204,17 +215,17 @@ def download_default_models_if_necessary():
|
|||||||
print(model_type, "model(s) found.")
|
print(model_type, "model(s) found.")
|
||||||
|
|
||||||
|
|
||||||
def download_if_necessary(model_type: str, file_name: str, model_id: str):
|
def download_if_necessary(model_type: str, file_name: str, model_id: str, skip_if_others_exist=True):
|
||||||
model_path = os.path.join(app.MODELS_DIR, model_type, file_name)
|
model_path = os.path.join(app.MODELS_DIR, model_type, file_name)
|
||||||
expected_hash = get_model_info_from_db(model_type=model_type, model_id=model_id)["quick_hash"]
|
expected_hash = get_model_info_from_db(model_type=model_type, model_id=model_id)["quick_hash"]
|
||||||
|
|
||||||
other_models_exist = any_model_exists(model_type)
|
other_models_exist = any_model_exists(model_type) and skip_if_others_exist
|
||||||
known_model_exists = os.path.exists(model_path)
|
known_model_exists = os.path.exists(model_path)
|
||||||
known_model_is_corrupt = known_model_exists and hash_file_quick(model_path) != expected_hash
|
known_model_is_corrupt = known_model_exists and hash_file_quick(model_path) != expected_hash
|
||||||
|
|
||||||
if known_model_is_corrupt or (not other_models_exist and not known_model_exists):
|
if known_model_is_corrupt or (not other_models_exist and not known_model_exists):
|
||||||
print("> download", model_type, model_id)
|
print("> download", model_type, model_id)
|
||||||
download_model(model_type, model_id, download_base_dir=app.MODELS_DIR)
|
download_model(model_type, model_id, download_base_dir=app.MODELS_DIR, download_config_if_available=False)
|
||||||
|
|
||||||
|
|
||||||
def migrate_legacy_model_location():
|
def migrate_legacy_model_location():
|
||||||
@ -285,12 +296,26 @@ def is_malicious_model(file_path):
|
|||||||
def getModels(scan_for_malicious: bool = True):
|
def getModels(scan_for_malicious: bool = True):
|
||||||
models = {
|
models = {
|
||||||
"options": {
|
"options": {
|
||||||
"stable-diffusion": ["sd-v1-4"],
|
"stable-diffusion": [{"sd-v1-4": "SD 1.4"}],
|
||||||
"vae": [],
|
"vae": [],
|
||||||
"hypernetwork": [],
|
"hypernetwork": [],
|
||||||
"lora": [],
|
"lora": [],
|
||||||
"codeformer": ["codeformer"],
|
"codeformer": [{"codeformer": "CodeFormer"}],
|
||||||
"embeddings": [],
|
"embeddings": [],
|
||||||
|
"controlnet": [
|
||||||
|
{"control_v11p_sd15_canny": "Canny (*)"},
|
||||||
|
{"control_v11p_sd15_openpose": "OpenPose (*)"},
|
||||||
|
{"control_v11p_sd15_normalbae": "Normal BAE (*)"},
|
||||||
|
{"control_v11f1p_sd15_depth": "Depth (*)"},
|
||||||
|
{"control_v11p_sd15_scribble": "Scribble"},
|
||||||
|
{"control_v11p_sd15_softedge": "Soft Edge"},
|
||||||
|
{"control_v11p_sd15_inpaint": "Inpaint"},
|
||||||
|
{"control_v11p_sd15_lineart": "Line Art"},
|
||||||
|
{"control_v11p_sd15s2_lineart_anime": "Line Art Anime"},
|
||||||
|
{"control_v11p_sd15_mlsd": "Straight Lines"},
|
||||||
|
{"control_v11p_sd15_seg": "Segment"},
|
||||||
|
{"control_v11e_sd15_shuffle": "Shuffle"},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -299,9 +324,9 @@ def getModels(scan_for_malicious: bool = True):
|
|||||||
class MaliciousModelException(Exception):
|
class MaliciousModelException(Exception):
|
||||||
"Raised when picklescan reports a problem with a model"
|
"Raised when picklescan reports a problem with a model"
|
||||||
|
|
||||||
def scan_directory(directory, suffixes, directoriesFirst: bool = True):
|
def scan_directory(directory, suffixes, directoriesFirst: bool = True, default_entries=[]):
|
||||||
|
tree = list(default_entries)
|
||||||
nonlocal models_scanned
|
nonlocal models_scanned
|
||||||
tree = []
|
|
||||||
for entry in sorted(
|
for entry in sorted(
|
||||||
os.scandir(directory),
|
os.scandir(directory),
|
||||||
key=lambda entry: (entry.is_file() == directoriesFirst, entry.name.lower()),
|
key=lambda entry: (entry.is_file() == directoriesFirst, entry.name.lower()),
|
||||||
@ -320,7 +345,14 @@ def getModels(scan_for_malicious: bool = True):
|
|||||||
raise MaliciousModelException(entry.path)
|
raise MaliciousModelException(entry.path)
|
||||||
if scan_for_malicious:
|
if scan_for_malicious:
|
||||||
known_models[entry.path] = mtime
|
known_models[entry.path] = mtime
|
||||||
tree.append(entry.name[: -len(matching_suffix)])
|
model_id = entry.name[: -len(matching_suffix)]
|
||||||
|
model_exists = False
|
||||||
|
for m in tree: # allows default "named" models, like CodeFormer and known ControlNet models
|
||||||
|
if (isinstance(m, str) and model_id == m) or (isinstance(m, dict) and model_id in m):
|
||||||
|
model_exists = True
|
||||||
|
break
|
||||||
|
if not model_exists:
|
||||||
|
tree.append(model_id)
|
||||||
elif entry.is_dir():
|
elif entry.is_dir():
|
||||||
scan = scan_directory(entry.path, suffixes, directoriesFirst=False)
|
scan = scan_directory(entry.path, suffixes, directoriesFirst=False)
|
||||||
|
|
||||||
@ -337,7 +369,8 @@ def getModels(scan_for_malicious: bool = True):
|
|||||||
os.makedirs(models_dir)
|
os.makedirs(models_dir)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
models["options"][model_type] = scan_directory(models_dir, model_extensions)
|
default_tree = models["options"].get(model_type, [])
|
||||||
|
models["options"][model_type] = scan_directory(models_dir, model_extensions, default_entries=default_tree)
|
||||||
except MaliciousModelException as e:
|
except MaliciousModelException as e:
|
||||||
models["scan-error"] = str(e)
|
models["scan-error"] = str(e)
|
||||||
|
|
||||||
@ -350,6 +383,7 @@ def getModels(scan_for_malicious: bool = True):
|
|||||||
listModels(model_type="gfpgan")
|
listModels(model_type="gfpgan")
|
||||||
listModels(model_type="lora")
|
listModels(model_type="lora")
|
||||||
listModels(model_type="embeddings")
|
listModels(model_type="embeddings")
|
||||||
|
listModels(model_type="controlnet")
|
||||||
|
|
||||||
if scan_for_malicious and models_scanned > 0:
|
if scan_for_malicious and models_scanned > 0:
|
||||||
log.info(f"[green]Scanned {models_scanned} models. Nothing infected[/]")
|
log.info(f"[green]Scanned {models_scanned} models. Nothing infected[/]")
|
||||||
|
@ -63,7 +63,7 @@ class RenderTask(Task):
|
|||||||
if (
|
if (
|
||||||
runtime.set_vram_optimizations(context)
|
runtime.set_vram_optimizations(context)
|
||||||
or self.has_param_changed(context, "clip_skip")
|
or self.has_param_changed(context, "clip_skip")
|
||||||
or self.has_param_changed(context, "convert_to_tensorrt")
|
or self.trt_needs_reload(context)
|
||||||
):
|
):
|
||||||
models_to_force_reload.append("stable-diffusion")
|
models_to_force_reload.append("stable-diffusion")
|
||||||
|
|
||||||
@ -92,6 +92,17 @@ class RenderTask(Task):
|
|||||||
new_val = self.models_data.model_params.get("stable-diffusion", {}).get(param_name, False)
|
new_val = self.models_data.model_params.get("stable-diffusion", {}).get(param_name, False)
|
||||||
return model["params"].get(param_name) != new_val
|
return model["params"].get(param_name) != new_val
|
||||||
|
|
||||||
|
def trt_needs_reload(self, context):
|
||||||
|
if not self.has_param_changed(context, "convert_to_tensorrt"):
|
||||||
|
return False
|
||||||
|
|
||||||
|
model = context.models["stable-diffusion"]
|
||||||
|
pipe = model["default"]
|
||||||
|
if hasattr(pipe.unet, "_allocate_trt_buffers"): # TRT already loaded
|
||||||
|
return False
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
def make_images(
|
def make_images(
|
||||||
context,
|
context,
|
||||||
@ -148,6 +159,7 @@ def make_images_internal(
|
|||||||
context,
|
context,
|
||||||
req,
|
req,
|
||||||
task_data,
|
task_data,
|
||||||
|
models_data,
|
||||||
data_queue,
|
data_queue,
|
||||||
task_temp_images,
|
task_temp_images,
|
||||||
step_callback,
|
step_callback,
|
||||||
@ -174,6 +186,7 @@ def generate_images_internal(
|
|||||||
context,
|
context,
|
||||||
req: GenerateImageRequest,
|
req: GenerateImageRequest,
|
||||||
task_data: TaskData,
|
task_data: TaskData,
|
||||||
|
models_data: ModelsData,
|
||||||
data_queue: queue.Queue,
|
data_queue: queue.Queue,
|
||||||
task_temp_images: list,
|
task_temp_images: list,
|
||||||
step_callback,
|
step_callback,
|
||||||
@ -197,6 +210,18 @@ def generate_images_internal(
|
|||||||
if req.init_image is not None and not context.test_diffusers:
|
if req.init_image is not None and not context.test_diffusers:
|
||||||
req.sampler_name = "ddim"
|
req.sampler_name = "ddim"
|
||||||
|
|
||||||
|
if req.control_image and task_data.control_filter_to_apply:
|
||||||
|
req.control_image = filter_images(context, req.control_image, task_data.control_filter_to_apply)[0]
|
||||||
|
|
||||||
|
if context.test_diffusers:
|
||||||
|
pipe = context.models["stable-diffusion"]["default"]
|
||||||
|
if hasattr(pipe.unet, "_allocate_trt_buffers"):
|
||||||
|
convert_to_trt = models_data.model_params["stable-diffusion"].get("convert_to_tensorrt", False)
|
||||||
|
pipe.unet.forward = pipe.unet._trt_forward if convert_to_trt else pipe.unet._non_trt_forward
|
||||||
|
# pipe.vae.decoder.forward = (
|
||||||
|
# pipe.vae.decoder._trt_forward if convert_to_trt else pipe.vae.decoder._non_trt_forward
|
||||||
|
# )
|
||||||
|
|
||||||
images = generate_images(context, callback=callback, **req.dict())
|
images = generate_images(context, callback=callback, **req.dict())
|
||||||
user_stopped = False
|
user_stopped = False
|
||||||
except UserInitiatedStop:
|
except UserInitiatedStop:
|
||||||
|
@ -75,6 +75,7 @@ class TaskData(BaseModel):
|
|||||||
use_controlnet_model: Union[str, List[str]] = None
|
use_controlnet_model: Union[str, List[str]] = None
|
||||||
filters: List[str] = []
|
filters: List[str] = []
|
||||||
filter_params: Dict[str, Dict[str, Any]] = {}
|
filter_params: Dict[str, Dict[str, Any]] = {}
|
||||||
|
control_filter_to_apply: Union[str, List[str]] = None
|
||||||
|
|
||||||
show_only_filtered_image: bool = False
|
show_only_filtered_image: bool = False
|
||||||
block_nsfw: bool = False
|
block_nsfw: bool = False
|
||||||
@ -135,6 +136,7 @@ class GenerateImageResponse:
|
|||||||
def json(self):
|
def json(self):
|
||||||
del self.render_request.init_image
|
del self.render_request.init_image
|
||||||
del self.render_request.init_image_mask
|
del self.render_request.init_image_mask
|
||||||
|
del self.render_request.control_image
|
||||||
|
|
||||||
task_data = self.task_data.dict()
|
task_data = self.task_data.dict()
|
||||||
task_data.update(self.output_format.dict())
|
task_data.update(self.output_format.dict())
|
||||||
@ -212,6 +214,9 @@ def convert_legacy_render_req_to_new(old_req: dict):
|
|||||||
model_paths["latent_upscaler"] = (
|
model_paths["latent_upscaler"] = (
|
||||||
model_paths["latent_upscaler"] if "latent_upscaler" in model_paths["latent_upscaler"].lower() else None
|
model_paths["latent_upscaler"] if "latent_upscaler" in model_paths["latent_upscaler"].lower() else None
|
||||||
)
|
)
|
||||||
|
if "control_filter_to_apply" in old_req:
|
||||||
|
filter_model = old_req["control_filter_to_apply"]
|
||||||
|
model_paths[filter_model] = filter_model
|
||||||
|
|
||||||
if old_req.get("block_nsfw"):
|
if old_req.get("block_nsfw"):
|
||||||
model_paths["nsfw_checker"] = "nsfw_checker"
|
model_paths["nsfw_checker"] = "nsfw_checker"
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
<h1>
|
<h1>
|
||||||
<img id="logo_img" src="/media/images/icon-512x512.png" >
|
<img id="logo_img" src="/media/images/icon-512x512.png" >
|
||||||
Easy Diffusion
|
Easy Diffusion
|
||||||
<small><span id="version">v2.5.47</span> <span id="updateBranchLabel"></span></small>
|
<small><span id="version">v2.5.48</span> <span id="updateBranchLabel"></span></small>
|
||||||
</h1>
|
</h1>
|
||||||
</div>
|
</div>
|
||||||
<div id="server-status">
|
<div id="server-status">
|
||||||
@ -85,8 +85,8 @@
|
|||||||
<label for="init_image">Initial Image (img2img) <small>(optional)</small> </label>
|
<label for="init_image">Initial Image (img2img) <small>(optional)</small> </label>
|
||||||
|
|
||||||
<div id="init_image_preview_container" class="image_preview_container">
|
<div id="init_image_preview_container" class="image_preview_container">
|
||||||
<div id="init_image_wrapper">
|
<div id="init_image_wrapper" class="preview_image_wrapper">
|
||||||
<img id="init_image_preview" src="" crossorigin="anonymous" />
|
<img id="init_image_preview" class="image_preview" src="" crossorigin="anonymous" />
|
||||||
<span id="init_image_size_box" class="img_bottom_label"></span>
|
<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>
|
<button class="init_image_clear image_clear_btn"><i class="fa-solid fa-xmark"></i></button>
|
||||||
</div>
|
</div>
|
||||||
@ -143,18 +143,17 @@
|
|||||||
<div><table>
|
<div><table>
|
||||||
<tr><b class="settings-subheader">Image Settings</b></tr>
|
<tr><b class="settings-subheader">Image Settings</b></tr>
|
||||||
<tr class="pl-5"><td><label for="seed">Seed:</label></td><td><input id="seed" name="seed" size="10" value="0" onkeypress="preventNonNumericalInput(event)"> <input id="random_seed" name="random_seed" type="checkbox" checked><label for="random_seed">Random</label></td></tr>
|
<tr class="pl-5"><td><label for="seed">Seed:</label></td><td><input id="seed" name="seed" size="10" value="0" onkeypress="preventNonNumericalInput(event)"> <input id="random_seed" name="random_seed" type="checkbox" checked><label for="random_seed">Random</label></td></tr>
|
||||||
<tr class="pl-5"><td><label for="num_outputs_total">Number of Images:</label></td><td><input id="num_outputs_total" name="num_outputs_total" value="1" size="1" onkeypress="preventNonNumericalInput(event)"> <label><small>(total)</small></label> <input id="num_outputs_parallel" name="num_outputs_parallel" value="1" size="1" onkeypress="preventNonNumericalInput(event)"> <label for="num_outputs_parallel"><small>(in parallel)</small></label></td></tr>
|
<tr class="pl-5"><td><label for="num_outputs_total">Number of Images:</label></td><td><input id="num_outputs_total" name="num_outputs_total" value="1" size="1" onkeypress="preventNonNumericalInput(event)"> <label><small>(total)</small></label> <input id="num_outputs_parallel" name="num_outputs_parallel" value="1" size="1" onkeypress="preventNonNumericalInput(event)"> <label id="num_outputs_parallel_label" for="num_outputs_parallel"><small>(in parallel)</small></label></td></tr>
|
||||||
<tr class="pl-5"><td><label for="stable_diffusion_model">Model:</label></td><td class="model-input">
|
<tr class="pl-5"><td><label for="stable_diffusion_model">Model:</label></td><td class="model-input">
|
||||||
<input id="stable_diffusion_model" type="text" spellcheck="false" autocomplete="off" class="model-filter" data-path="" />
|
<input id="stable_diffusion_model" type="text" spellcheck="false" autocomplete="off" class="model-filter" data-path="" />
|
||||||
<button id="reload-models" class="secondaryButton reloadModels"><i class='fa-solid fa-rotate'></i></button>
|
<button id="reload-models" class="secondaryButton reloadModels"><i class='fa-solid fa-rotate'></i></button>
|
||||||
<a href="https://github.com/easydiffusion/easydiffusion/wiki/Custom-Models" target="_blank"><i class="fa-solid fa-circle-question help-btn"><span class="simple-tooltip top-left">Click to learn more about custom models</span></i></a>
|
<a href="https://github.com/easydiffusion/easydiffusion/wiki/Custom-Models" target="_blank"><i class="fa-solid fa-circle-question help-btn"><span class="simple-tooltip top-left">Click to learn more about custom models</span></i></a>
|
||||||
</td></tr>
|
</td></tr>
|
||||||
<tr class="pl-5 displayNone" id="enable_trt_config">
|
<tr class="pl-5 displayNone" id="enable_trt_config">
|
||||||
<td><label for="convert_to_tensorrt">Convert to TensorRT:</label></td>
|
<td><label for="convert_to_tensorrt">Enable TensorRT:</label></td>
|
||||||
<td class="diffusers-restart-needed">
|
<td class="diffusers-restart-needed">
|
||||||
<input id="convert_to_tensorrt" name="convert_to_tensorrt" type="checkbox">
|
<input id="convert_to_tensorrt" name="convert_to_tensorrt" type="checkbox">
|
||||||
<a href="https://github.com/easydiffusion/easydiffusion/wiki/TensorRT" target="_blank"><i class="fa-solid fa-circle-question help-btn"><span class="simple-tooltip top-left">Click to learn more about TensorRT</span></i></a>
|
<!-- <label><small>Takes upto 20 mins the first time</small></label> -->
|
||||||
<label><small>Takes upto 20 mins the first time</small></label>
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="pl-5 displayNone" id="clip_skip_config">
|
<tr class="pl-5 displayNone" id="clip_skip_config">
|
||||||
@ -164,6 +163,60 @@
|
|||||||
<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>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr id="controlnet_model_container" class="pl-5"><td><label for="controlnet_model">ControlNet Image:</label></td><td>
|
||||||
|
<div id="control_image_wrapper" class="preview_image_wrapper">
|
||||||
|
<img id="control_image_preview" class="image_preview" src="" crossorigin="anonymous" />
|
||||||
|
<span id="control_image_size_box" class="img_bottom_label"></span>
|
||||||
|
<button class="control_image_clear image_clear_btn"><i class="fa-solid fa-xmark"></i></button>
|
||||||
|
</div>
|
||||||
|
<input id="control_image" name="control_image" type="file" />
|
||||||
|
<a href="https://github.com/easydiffusion/easydiffusion/wiki/ControlNet" target="_blank"><i class="fa-solid fa-circle-question help-btn"><span class="simple-tooltip top-left">Click to learn more about ControlNets</span></i></a>
|
||||||
|
<div id="controlnet_config" class="displayNone">
|
||||||
|
<label><small>Filter to apply:</small></label>
|
||||||
|
<select id="control_image_filter">
|
||||||
|
<option value="">None</option>
|
||||||
|
<optgroup label="Pose">
|
||||||
|
<option value="openpose">OpenPose (*)</option>
|
||||||
|
<option value="openpose_face">OpenPose face</option>
|
||||||
|
<option value="openpose_faceonly">OpenPose face-only</option>
|
||||||
|
<option value="openpose_hand">OpenPose hand</option>
|
||||||
|
<option value="openpose_full">OpenPose full</option>
|
||||||
|
</optgroup>
|
||||||
|
<optgroup label="Outline">
|
||||||
|
<option value="canny">Canny (*)</option>
|
||||||
|
<option value="mlsd">Straight lines</option>
|
||||||
|
<option value="scribble_hed">Scribble hed (*)</option>
|
||||||
|
<option value="scribble_hedsafe">Scribble hedsafe</option>
|
||||||
|
<option value="scribble_pidinet">Scribble pidinet</option>
|
||||||
|
<option value="scribble_pidsafe">Scribble pidsafe</option>
|
||||||
|
<option value="softedge_hed">Softedge hed</option>
|
||||||
|
<option value="softedge_hedsafe">Softedge hedsafe</option>
|
||||||
|
<option value="softedge_pidinet">Softedge pidinet</option>
|
||||||
|
<option value="softedge_pidsafe">Softedge pidsafe</option>
|
||||||
|
</optgroup>
|
||||||
|
<optgroup label="Depth">
|
||||||
|
<option value="normal_bae">Normal bae (*)</option>
|
||||||
|
<option value="depth_midas">Depth midas</option>
|
||||||
|
<option value="depth_zoe">Depth zoe</option>
|
||||||
|
<option value="depth_leres">Depth leres</option>
|
||||||
|
<option value="depth_leres++">Depth leres++</option>
|
||||||
|
</optgroup>
|
||||||
|
<optgroup label="Line art">
|
||||||
|
<option value="lineart_coarse">Lineart coarse</option>
|
||||||
|
<option value="lineart_realistic">Lineart realistic</option>
|
||||||
|
<option value="lineart_anime">Lineart anime</option>
|
||||||
|
</optgroup>
|
||||||
|
<optgroup label="Misc">
|
||||||
|
<option value="shuffle">Shuffle</option>
|
||||||
|
<option value="segment">Segment</option>
|
||||||
|
</optgroup>
|
||||||
|
</select>
|
||||||
|
<br/>
|
||||||
|
<label for="controlnet_model"><small>Model:</small></label> <input id="controlnet_model" type="text" spellcheck="false" autocomplete="off" class="model-filter" data-path="" />
|
||||||
|
<br/>
|
||||||
|
<label><small>Will download the necessary models, the first time.</small></label>
|
||||||
|
</div>
|
||||||
|
</td></tr>
|
||||||
<tr class="pl-5"><td><label for="vae_model">Custom VAE:</label></td><td>
|
<tr class="pl-5"><td><label for="vae_model">Custom VAE:</label></td><td>
|
||||||
<input id="vae_model" type="text" spellcheck="false" autocomplete="off" class="model-filter" data-path="" />
|
<input id="vae_model" type="text" spellcheck="false" autocomplete="off" class="model-filter" data-path="" />
|
||||||
<a href="https://github.com/easydiffusion/easydiffusion/wiki/VAE-Variational-Auto-Encoder" target="_blank"><i class="fa-solid fa-circle-question help-btn"><span class="simple-tooltip top-left">Click to learn more about VAEs</span></i></a>
|
<a href="https://github.com/easydiffusion/easydiffusion/wiki/VAE-Variational-Auto-Encoder" target="_blank"><i class="fa-solid fa-circle-question help-btn"><span class="simple-tooltip top-left">Click to learn more about VAEs</span></i></a>
|
||||||
@ -241,7 +294,7 @@
|
|||||||
</select>
|
</select>
|
||||||
<label for="height"><small>(height)</small></label>
|
<label for="height"><small>(height)</small></label>
|
||||||
<div id="recent-resolutions-container">
|
<div id="recent-resolutions-container">
|
||||||
<span id="recent-resolutions-button" class="clickable"><i class="fa-solid fa-sliders"><span class="simple-tooltip top-left"> Recent sizes </span></i></span>
|
<span id="recent-resolutions-button" class="clickable"><i class="fa-solid fa-sliders"><span class="simple-tooltip top-left"> Advanced sizes </span></i></span>
|
||||||
<div id="recent-resolutions-popup" class="displayNone">
|
<div id="recent-resolutions-popup" class="displayNone">
|
||||||
<small>Custom size:</small><br>
|
<small>Custom size:</small><br>
|
||||||
<input id="custom-width" name="custom-width" type="number" min="128" value="512" onkeypress="preventNonNumericalInput(event)">
|
<input id="custom-width" name="custom-width" type="number" min="128" value="512" onkeypress="preventNonNumericalInput(event)">
|
||||||
@ -737,7 +790,7 @@ async function init() {
|
|||||||
ping: onPing
|
ping: onPing
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
splashScreen()
|
// splashScreen()
|
||||||
|
|
||||||
// load models again, but scan for malicious this time
|
// load models again, but scan for malicious this time
|
||||||
await getModels(true)
|
await getModels(true)
|
||||||
|
@ -794,7 +794,7 @@ div.img-preview img {
|
|||||||
margin-bottom: 8px;
|
margin-bottom: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#init_image_preview_container:not(.has-image) #init_image_wrapper,
|
#init_image_preview_container:not(.has-image) .preview_image_wrapper,
|
||||||
#init_image_preview_container:not(.has-image) #inpaint_button_container {
|
#init_image_preview_container:not(.has-image) #inpaint_button_container {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
@ -831,14 +831,14 @@ div.img-preview img {
|
|||||||
gap: 8px;
|
gap: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#init_image_wrapper {
|
.preview_image_wrapper {
|
||||||
grid-row: span 3;
|
grid-row: span 3;
|
||||||
position: relative;
|
position: relative;
|
||||||
width: fit-content;
|
width: fit-content;
|
||||||
max-height: 150px;
|
max-height: 150px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#init_image_preview {
|
.image_preview {
|
||||||
max-height: 150px;
|
max-height: 150px;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@ -1843,3 +1843,13 @@ div#enlarge-buttons {
|
|||||||
.imgContainer .spinnerStatus {
|
.imgContainer .spinnerStatus {
|
||||||
font-size: 10pt;
|
font-size: 10pt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#controlnet_model_container small {
|
||||||
|
color: var(--text-color)
|
||||||
|
}
|
||||||
|
#control_image {
|
||||||
|
width: 130pt;
|
||||||
|
}
|
||||||
|
#controlnet_model {
|
||||||
|
width: 77%;
|
||||||
|
}
|
@ -93,6 +93,11 @@ let initImagePreview = document.querySelector("#init_image_preview")
|
|||||||
let initImageSizeBox = document.querySelector("#init_image_size_box")
|
let initImageSizeBox = document.querySelector("#init_image_size_box")
|
||||||
let maskImageSelector = document.querySelector("#mask")
|
let maskImageSelector = document.querySelector("#mask")
|
||||||
let maskImagePreview = document.querySelector("#mask_preview")
|
let maskImagePreview = document.querySelector("#mask_preview")
|
||||||
|
let controlImageSelector = document.querySelector("#control_image")
|
||||||
|
let controlImagePreview = document.querySelector("#control_image_preview")
|
||||||
|
let controlImageClearBtn = document.querySelector(".control_image_clear")
|
||||||
|
let controlImageContainer = document.querySelector("#control_image_wrapper")
|
||||||
|
let controlImageFilterField = document.querySelector("#control_image_filter")
|
||||||
let applyColorCorrectionField = document.querySelector("#apply_color_correction")
|
let applyColorCorrectionField = document.querySelector("#apply_color_correction")
|
||||||
let strictMaskBorderField = document.querySelector("#strict_mask_border")
|
let strictMaskBorderField = document.querySelector("#strict_mask_border")
|
||||||
let colorCorrectionSetting = document.querySelector("#apply_color_correction_setting")
|
let colorCorrectionSetting = document.querySelector("#apply_color_correction_setting")
|
||||||
@ -114,6 +119,7 @@ let codeformerFidelityField = document.querySelector("#codeformer_fidelity")
|
|||||||
let stableDiffusionModelField = new ModelDropdown(document.querySelector("#stable_diffusion_model"), "stable-diffusion")
|
let stableDiffusionModelField = new ModelDropdown(document.querySelector("#stable_diffusion_model"), "stable-diffusion")
|
||||||
let clipSkipField = document.querySelector("#clip_skip")
|
let clipSkipField = document.querySelector("#clip_skip")
|
||||||
let tilingField = document.querySelector("#tiling")
|
let tilingField = document.querySelector("#tiling")
|
||||||
|
let controlnetModelField = new ModelDropdown(document.querySelector("#controlnet_model"), "controlnet", "None", false)
|
||||||
let vaeModelField = new ModelDropdown(document.querySelector("#vae_model"), "vae", "None")
|
let vaeModelField = new ModelDropdown(document.querySelector("#vae_model"), "vae", "None")
|
||||||
let hypernetworkModelField = new ModelDropdown(document.querySelector("#hypernetwork_model"), "hypernetwork", "None")
|
let hypernetworkModelField = new ModelDropdown(document.querySelector("#hypernetwork_model"), "hypernetwork", "None")
|
||||||
let hypernetworkStrengthSlider = document.querySelector("#hypernetwork_strength_slider")
|
let hypernetworkStrengthSlider = document.querySelector("#hypernetwork_strength_slider")
|
||||||
@ -1378,9 +1384,19 @@ function createTask(task) {
|
|||||||
|
|
||||||
function getCurrentUserRequest() {
|
function getCurrentUserRequest() {
|
||||||
const numOutputsTotal = parseInt(numOutputsTotalField.value)
|
const numOutputsTotal = parseInt(numOutputsTotalField.value)
|
||||||
const numOutputsParallel = parseInt(numOutputsParallelField.value)
|
let numOutputsParallel = parseInt(numOutputsParallelField.value)
|
||||||
const seed = randomSeedField.checked ? Math.floor(Math.random() * (2 ** 32 - 1)) : parseInt(seedField.value)
|
const seed = randomSeedField.checked ? Math.floor(Math.random() * (2 ** 32 - 1)) : parseInt(seedField.value)
|
||||||
|
|
||||||
|
if (
|
||||||
|
testDiffusers.checked &&
|
||||||
|
document.getElementById("toggle-tensorrt-install").innerHTML == "Uninstall" &&
|
||||||
|
document.querySelector("#convert_to_tensorrt").checked
|
||||||
|
) {
|
||||||
|
// TRT enabled
|
||||||
|
|
||||||
|
numOutputsParallel = 1 // force 1 parallel
|
||||||
|
}
|
||||||
|
|
||||||
const newTask = {
|
const newTask = {
|
||||||
batchesDone: 0,
|
batchesDone: 0,
|
||||||
numOutputsTotal: numOutputsTotal,
|
numOutputsTotal: numOutputsTotal,
|
||||||
@ -1469,6 +1485,13 @@ function getCurrentUserRequest() {
|
|||||||
// TRT is installed
|
// TRT is installed
|
||||||
newTask.reqBody.convert_to_tensorrt = document.querySelector("#convert_to_tensorrt").checked
|
newTask.reqBody.convert_to_tensorrt = document.querySelector("#convert_to_tensorrt").checked
|
||||||
}
|
}
|
||||||
|
if (controlnetModelField.value !== "" && IMAGE_REGEX.test(controlImagePreview.src)) {
|
||||||
|
newTask.reqBody.use_controlnet_model = controlnetModelField.value
|
||||||
|
newTask.reqBody.control_image = controlImagePreview.src
|
||||||
|
if (controlImageFilterField.value !== "") {
|
||||||
|
newTask.reqBody.control_filter_to_apply = controlImageFilterField.value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return newTask
|
return newTask
|
||||||
}
|
}
|
||||||
@ -1875,6 +1898,51 @@ function onFixFaceModelChange() {
|
|||||||
gfpganModelField.addEventListener("change", onFixFaceModelChange)
|
gfpganModelField.addEventListener("change", onFixFaceModelChange)
|
||||||
onFixFaceModelChange()
|
onFixFaceModelChange()
|
||||||
|
|
||||||
|
function onControlnetModelChange() {
|
||||||
|
let configBox = document.querySelector("#controlnet_config")
|
||||||
|
if (IMAGE_REGEX.test(controlImagePreview.src)) {
|
||||||
|
configBox.classList.remove("displayNone")
|
||||||
|
controlImageContainer.classList.remove("displayNone")
|
||||||
|
} else {
|
||||||
|
configBox.classList.add("displayNone")
|
||||||
|
controlImageContainer.classList.add("displayNone")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
controlImagePreview.addEventListener("load", onControlnetModelChange)
|
||||||
|
controlImagePreview.addEventListener("unload", onControlnetModelChange)
|
||||||
|
onControlnetModelChange()
|
||||||
|
|
||||||
|
function onControlImageFilterChange() {
|
||||||
|
let filterId = controlImageFilterField.value
|
||||||
|
if (filterId.includes("openpose")) {
|
||||||
|
controlnetModelField.value = "control_v11p_sd15_openpose"
|
||||||
|
} else if (filterId === "canny") {
|
||||||
|
controlnetModelField.value = "control_v11p_sd15_canny"
|
||||||
|
} else if (filterId === "mlsd") {
|
||||||
|
controlnetModelField.value = "control_v11p_sd15_mlsd"
|
||||||
|
} else if (filterId === "mlsd") {
|
||||||
|
controlnetModelField.value = "control_v11p_sd15_mlsd"
|
||||||
|
} else if (filterId.includes("scribble")) {
|
||||||
|
controlnetModelField.value = "control_v11p_sd15_scribble"
|
||||||
|
} else if (filterId.includes("softedge")) {
|
||||||
|
controlnetModelField.value = "control_v11p_sd15_softedge"
|
||||||
|
} else if (filterId === "normal_bae") {
|
||||||
|
controlnetModelField.value = "control_v11p_sd15_normalbae"
|
||||||
|
} else if (filterId.includes("depth")) {
|
||||||
|
controlnetModelField.value = "control_v11f1p_sd15_depth"
|
||||||
|
} else if (filterId === "lineart_anime") {
|
||||||
|
controlnetModelField.value = "control_v11p_sd15s2_lineart_anime"
|
||||||
|
} else if (filterId.includes("lineart")) {
|
||||||
|
controlnetModelField.value = "control_v11p_sd15_lineart"
|
||||||
|
} else if (filterId === "shuffle") {
|
||||||
|
controlnetModelField.value = "control_v11e_sd15_shuffle"
|
||||||
|
} else if (filterId === "segment") {
|
||||||
|
controlnetModelField.value = "control_v11p_sd15_seg"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
controlImageFilterField.addEventListener("change", onControlImageFilterChange)
|
||||||
|
onControlImageFilterChange()
|
||||||
|
|
||||||
upscaleModelField.disabled = !useUpscalingField.checked
|
upscaleModelField.disabled = !useUpscalingField.checked
|
||||||
upscaleAmountField.disabled = !useUpscalingField.checked
|
upscaleAmountField.disabled = !useUpscalingField.checked
|
||||||
useUpscalingField.addEventListener("change", function(e) {
|
useUpscalingField.addEventListener("change", function(e) {
|
||||||
@ -2165,6 +2233,44 @@ promptsFromFileBtn.addEventListener("click", function() {
|
|||||||
promptsFromFileSelector.click()
|
promptsFromFileSelector.click()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
function loadControlnetImageFromFile() {
|
||||||
|
if (controlImageSelector.files.length === 0) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
let reader = new FileReader()
|
||||||
|
let file = controlImageSelector.files[0]
|
||||||
|
|
||||||
|
reader.addEventListener("load", function(event) {
|
||||||
|
controlImagePreview.src = reader.result
|
||||||
|
})
|
||||||
|
|
||||||
|
if (file) {
|
||||||
|
reader.readAsDataURL(file)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
controlImageSelector.addEventListener("change", loadControlnetImageFromFile)
|
||||||
|
|
||||||
|
function controlImageLoad() {
|
||||||
|
let w = controlImagePreview.naturalWidth
|
||||||
|
let h = controlImagePreview.naturalHeight
|
||||||
|
addImageSizeOption(w)
|
||||||
|
addImageSizeOption(h)
|
||||||
|
|
||||||
|
widthField.value = w
|
||||||
|
heightField.value = h
|
||||||
|
widthField.dispatchEvent(new Event("change"))
|
||||||
|
heightField.dispatchEvent(new Event("change"))
|
||||||
|
}
|
||||||
|
controlImagePreview.addEventListener("load", controlImageLoad)
|
||||||
|
|
||||||
|
function controlImageUnload() {
|
||||||
|
controlImageSelector.value = null
|
||||||
|
controlImagePreview.src = ""
|
||||||
|
controlImagePreview.dispatchEvent(new Event("unload"))
|
||||||
|
}
|
||||||
|
controlImageClearBtn.addEventListener("click", controlImageUnload)
|
||||||
|
|
||||||
promptsFromFileSelector.addEventListener("change", async function() {
|
promptsFromFileSelector.addEventListener("change", async function() {
|
||||||
if (promptsFromFileSelector.files.length === 0) {
|
if (promptsFromFileSelector.files.length === 0) {
|
||||||
return
|
return
|
||||||
@ -2293,6 +2399,8 @@ function tunnelUpdate(event) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let trtSettingsForced = false
|
||||||
|
|
||||||
function packagesUpdate(event) {
|
function packagesUpdate(event) {
|
||||||
let trtBtn = document.getElementById("toggle-tensorrt-install")
|
let trtBtn = document.getElementById("toggle-tensorrt-install")
|
||||||
let trtInstalled = "packages_installed" in event && "tensorrt" in event["packages_installed"]
|
let trtInstalled = "packages_installed" in event && "tensorrt" in event["packages_installed"]
|
||||||
@ -2307,6 +2415,22 @@ function packagesUpdate(event) {
|
|||||||
|
|
||||||
if (document.getElementById("toggle-tensorrt-install").innerHTML == "Uninstall") {
|
if (document.getElementById("toggle-tensorrt-install").innerHTML == "Uninstall") {
|
||||||
document.querySelector("#enable_trt_config").classList.remove("displayNone")
|
document.querySelector("#enable_trt_config").classList.remove("displayNone")
|
||||||
|
|
||||||
|
if (!trtSettingsForced) {
|
||||||
|
// settings for demo
|
||||||
|
promptField.value = "Dragons fighting with a knight, castle, war scene, fantasy, cartoon, flames, HD"
|
||||||
|
seedField.value = 3187947173
|
||||||
|
widthField.value = 1024
|
||||||
|
heightField.value = 768
|
||||||
|
randomSeedField.checked = false
|
||||||
|
seedField.disabled = false
|
||||||
|
stableDiffusionModelField.value = "sd-v1-4"
|
||||||
|
|
||||||
|
numOutputsParallelField.classList.add("displayNone")
|
||||||
|
document.querySelector("#num_outputs_parallel_label").classList.add("displayNone")
|
||||||
|
|
||||||
|
trtSettingsForced = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -552,17 +552,23 @@ class ModelDropdown {
|
|||||||
this.createModelNodeList(`${folderName || ""}/${childFolderName}`, childModels, false)
|
this.createModelNodeList(`${folderName || ""}/${childFolderName}`, childModels, false)
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
|
let modelId = model
|
||||||
|
let modelName = model
|
||||||
|
if (typeof model === "object") {
|
||||||
|
modelId = Object.keys(model)[0]
|
||||||
|
modelName = model[modelId]
|
||||||
|
}
|
||||||
const classes = ["model-file"]
|
const classes = ["model-file"]
|
||||||
if (isRootFolder) {
|
if (isRootFolder) {
|
||||||
classes.push("in-root-folder")
|
classes.push("in-root-folder")
|
||||||
}
|
}
|
||||||
// Remove the leading slash from the model path
|
// Remove the leading slash from the model path
|
||||||
const fullPath = folderName ? `${folderName.substring(1)}/${model}` : model
|
const fullPath = folderName ? `${folderName.substring(1)}/${modelId}` : modelId
|
||||||
modelsMap.set(
|
modelsMap.set(
|
||||||
model,
|
modelId,
|
||||||
createElement("li", { "data-path": fullPath }, classes, [
|
createElement("li", { "data-path": fullPath }, classes, [
|
||||||
createElement("i", undefined, ["fa-regular", "fa-file", "icon"]),
|
createElement("i", undefined, ["fa-regular", "fa-file", "icon"]),
|
||||||
model,
|
modelName,
|
||||||
])
|
])
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -643,22 +649,6 @@ async function getModels(scanForMalicious = true) {
|
|||||||
makeImageBtn.disabled = true
|
makeImageBtn.disabled = true
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This code should no longer be needed. Commenting out for now, will cleanup later.
|
|
||||||
const sd_model_setting_key = "stable_diffusion_model"
|
|
||||||
const vae_model_setting_key = "vae_model"
|
|
||||||
const hypernetwork_model_key = "hypernetwork_model"
|
|
||||||
|
|
||||||
const stableDiffusionOptions = modelsOptions['stable-diffusion']
|
|
||||||
const vaeOptions = modelsOptions['vae']
|
|
||||||
const hypernetworkOptions = modelsOptions['hypernetwork']
|
|
||||||
|
|
||||||
// TODO: set default for model here too
|
|
||||||
SETTINGS[sd_model_setting_key].default = stableDiffusionOptions[0]
|
|
||||||
if (getSetting(sd_model_setting_key) == '' || SETTINGS[sd_model_setting_key].value == '') {
|
|
||||||
setSetting(sd_model_setting_key, stableDiffusionOptions[0])
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
// notify ModelDropdown objects to refresh
|
// notify ModelDropdown objects to refresh
|
||||||
document.dispatchEvent(new Event("refreshModels"))
|
document.dispatchEvent(new Event("refreshModels"))
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -667,4 +657,7 @@ async function getModels(scanForMalicious = true) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// reload models button
|
// reload models button
|
||||||
document.querySelector("#reload-models").addEventListener("click", () => getModels())
|
document.querySelector("#reload-models").addEventListener("click", (e) => {
|
||||||
|
e.stopPropagation()
|
||||||
|
getModels()
|
||||||
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user