fixed a possible issue with older versions of PIL

This commit is contained in:
AUTOMATIC 2022-08-24 01:08:59 +03:00
parent 81087207bc
commit 165da39fb1
1 changed files with 2 additions and 1 deletions

View File

@ -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)