[Bugfix][cherry-pick]: /images/edits endpoint fails pipeline data format check (#1173)
Signed-off-by: Huang, Zeyu <11222265+fhfuih@users.noreply.github.com> Co-authored-by: Huang, Zeyu <11222265+fhfuih@users.noreply.github.com>
This commit is contained in:
1 parent
ed89c8b043
commit
9505ba30ab
3 files changed
+27
-15
No files matched your search
@@ -72,11 +72,15 @@ def get_longcat_image_edit_pre_process_func(
|
|||||||
if "additional_information" not in prompt:
|
if "additional_information" not in prompt:
|
||||||
prompt["additional_information"] = {}
|
prompt["additional_information"] = {}
|
||||||
|
|
||||||
if raw_image is None or isinstance(raw_image, list):
|
if not raw_image: # None or empty list
|
||||||
raise ValueError(
|
raise ValueError("""Received no input image. This model requires one input image to run.""")
|
||||||
"""Received no image or a list of image. Only a single image is supported by this model."""
|
elif isinstance(raw_image, list):
|
||||||
"""Please correctly set `"multi_modal_data": {"image": <an image object or file path>, …}`"""
|
if len(raw_image) > 1:
|
||||||
)
|
raise ValueError(
|
||||||
|
"""Received multiple input images. Only a single image is supported by this model."""
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
raw_image = raw_image[0]
|
||||||
|
|
||||||
if isinstance(raw_image, str):
|
if isinstance(raw_image, str):
|
||||||
image = PIL.Image.open(raw_image)
|
image = PIL.Image.open(raw_image)
|
||||||
|
|||||||
@@ -75,11 +75,15 @@ def get_qwen_image_edit_pre_process_func(
|
|||||||
prompt["additional_information"] = {}
|
prompt["additional_information"] = {}
|
||||||
|
|
||||||
# Only handles single image
|
# Only handles single image
|
||||||
if raw_image is None or isinstance(raw_image, list):
|
if not raw_image: # None or empty list
|
||||||
raise ValueError(
|
raise ValueError("""Received no input image. This model requires one input image to run.""")
|
||||||
"""Received no image or a list of image. Only a single image is supported by this model."""
|
elif isinstance(raw_image, list):
|
||||||
"""Please correctly set `"multi_modal_data": {"image": <an image object or file path>, …}`"""
|
if len(raw_image) > 1:
|
||||||
)
|
raise ValueError(
|
||||||
|
"""Received multiple input images. Only a single image is supported by this model."""
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
raw_image = raw_image[0]
|
||||||
|
|
||||||
if isinstance(raw_image, str):
|
if isinstance(raw_image, str):
|
||||||
image = PIL.Image.open(raw_image)
|
image = PIL.Image.open(raw_image)
|
||||||
|
|||||||
@@ -79,11 +79,15 @@ def get_qwen_image_layered_pre_process_func(
|
|||||||
if "additional_information" not in prompt:
|
if "additional_information" not in prompt:
|
||||||
prompt["additional_information"] = {}
|
prompt["additional_information"] = {}
|
||||||
|
|
||||||
if raw_image is None or isinstance(raw_image, list):
|
if not raw_image: # None or empty list
|
||||||
raise ValueError(
|
raise ValueError("""Received no input image. This model requires one input image to run.""")
|
||||||
"""Received no image or a list of image. Only a single image is supported by this model."""
|
elif isinstance(raw_image, list):
|
||||||
"""Please correctly set `"multi_modal_data": {"image": <an image object or file path>, …}`"""
|
if len(raw_image) > 1:
|
||||||
)
|
raise ValueError(
|
||||||
|
"""Received multiple input images. Only a single image is supported by this model."""
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
raw_image = raw_image[0]
|
||||||
|
|
||||||
if isinstance(raw_image, str):
|
if isinstance(raw_image, str):
|
||||||
image = PIL.Image.open(raw_image)
|
image = PIL.Image.open(raw_image)
|
||||||
|
|||||||
Reference in new issue
Block a user