From 8dd0ff761f6b0847f53f54179188ed4b6f8e4483 Mon Sep 17 00:00:00 2001 From: "Laisky.Cai" Date: Thu, 8 Feb 2024 06:29:43 +0000 Subject: [PATCH] fix: load_image should support PIL Image --- src/diffusers/utils/loading_utils.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/diffusers/utils/loading_utils.py b/src/diffusers/utils/loading_utils.py index e129d5f3e366..18f6ead64c4e 100644 --- a/src/diffusers/utils/loading_utils.py +++ b/src/diffusers/utils/loading_utils.py @@ -32,6 +32,8 @@ def load_image( raise ValueError( f"Incorrect path or URL. URLs must start with `http://` or `https://`, and {image} is not a valid path." ) + elif isinstance(image, PIL.Image.Image): + image = image else: raise ValueError( "Incorrect format used for the image. Should be a URL linking to an image, a local path, or a PIL image."