diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2023-04-29 10:10:46 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-29 10:10:46 +0000 |
commit | 87535fcf292af8890520e7f346df0f41dd74353a (patch) | |
tree | 89c7f9ac26ae637f22f2db1efe69fb4aa51e9c70 /modules/images.py | |
parent | 02e351880796422eac3bbaf7aa86332b588651ce (diff) | |
parent | 1ffb44b0b2c9cb5fb379274515772741a9c1dbaf (diff) | |
download | stable-diffusion-webui-gfx803-87535fcf292af8890520e7f346df0f41dd74353a.tar.gz stable-diffusion-webui-gfx803-87535fcf292af8890520e7f346df0f41dd74353a.tar.bz2 stable-diffusion-webui-gfx803-87535fcf292af8890520e7f346df0f41dd74353a.zip |
Merge branch 'dev' into Branch_AddNewFilenameGen
Diffstat (limited to 'modules/images.py')
-rw-r--r-- | modules/images.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/modules/images.py b/modules/images.py index cdbb77e1..559de810 100644 --- a/modules/images.py +++ b/modules/images.py @@ -261,9 +261,12 @@ def resize_image(resize_mode, im, width, height, upscaler_name=None): if scale > 1.0:
upscalers = [x for x in shared.sd_upscalers if x.name == upscaler_name]
- assert len(upscalers) > 0, f"could not find upscaler named {upscaler_name}"
+ if len(upscalers) == 0:
+ upscaler = shared.sd_upscalers[0]
+ print(f"could not find upscaler named {upscaler_name or '<empty string>'}, using {upscaler.name} as a fallback")
+ else:
+ upscaler = upscalers[0]
- upscaler = upscalers[0]
im = upscaler.scaler.upscale(im, scale, upscaler.data_path)
if im.width != w or im.height != h:
@@ -350,6 +353,7 @@ class FilenameGenerator: 'prompt_spaces': lambda self: sanitize_filename_part(self.prompt, replace_spaces=False),
'prompt_words': lambda self: self.prompt_words(),
'hasprompt': lambda self, *args: self.hasprompt(*args), #accept formats:[hasprompt<prompt1|default><prompt2>..]
+ 'clip_skip': lambda self: opts.data["CLIP_stop_at_last_layers"],
}
default_time_format = '%Y%m%d%H%M%S'
@@ -662,6 +666,8 @@ Steps: {json_info["steps"]}, Sampler: {sampler}, CFG scale: {json_info["scale"]} def image_data(data):
+ import gradio as gr
+
try:
image = Image.open(io.BytesIO(data))
textinfo, _ = read_info_from_image(image)
@@ -677,7 +683,7 @@ def image_data(data): except Exception:
pass
- return '', None
+ return gr.update(), None
def flatten(img, bgcolor):
|