aboutsummaryrefslogtreecommitdiffstats
path: root/webui.py
diff options
context:
space:
mode:
authorAUTOMATIC <16777216c@gmail.com>2022-08-23 22:08:59 +0000
committerAUTOMATIC <16777216c@gmail.com>2022-08-23 22:08:59 +0000
commit165da39fb1a2ad89eb5b13429e7664d9ec8fd29f (patch)
tree8dc7cce85c911020278f1044818ee6903f4a7f92 /webui.py
parent81087207bc62026a3e6941553bf98f2da8c799d0 (diff)
downloadstable-diffusion-webui-gfx803-165da39fb1a2ad89eb5b13429e7664d9ec8fd29f.tar.gz
stable-diffusion-webui-gfx803-165da39fb1a2ad89eb5b13429e7664d9ec8fd29f.tar.bz2
stable-diffusion-webui-gfx803-165da39fb1a2ad89eb5b13429e7664d9ec8fd29f.zip
fixed a possible issue with older versions of PIL
Diffstat (limited to 'webui.py')
-rw-r--r--webui.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/webui.py b/webui.py
index 7aec795b..cfa42b13 100644
--- a/webui.py
+++ b/webui.py
@@ -34,6 +34,7 @@ mimetypes.add_type('application/javascript', '.js')
opt_C = 4
opt_f = 8
+LANCZOS = (Image.Resampling.LANCZOS if hasattr(Image, 'Resampling') else Image.LANCZOS)
invalid_filename_chars = '<>:"/\|?*\n'
parser = argparse.ArgumentParser()
@@ -490,7 +491,7 @@ def img2img(prompt: str, init_img, ddim_steps: int, use_GFPGAN: bool, prompt_mat
def init():
image = init_img.convert("RGB")
- image = image.resize((width, height), resample=Image.Resampling.LANCZOS)
+ image = image.resize((width, height), resample=LANCZOS)
image = np.array(image).astype(np.float32) / 255.0
image = image[None].transpose(0, 3, 1, 2)
image = torch.from_numpy(image)