Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Multiple Image Outputs are returned in a single byte buffer #418

Open
StephenHodgson opened this issue Mar 13, 2024 · 0 comments
Open

Comments

@StephenHodgson
Copy link
Contributor

Currently if you are attempting to return multiple image outputs from a pipeline task, all of the image data is crammed into a single binary response, which makes it almost impossible to decode and consume.

Ideally we should be returning multiple images like how we return multiple audio files, as json with each blob as image encoded to base64 string.

elif task in IMAGE_OUTPUTS:
image = outputs
image_format = parse_accept(accept, IMAGE)
buffer = io.BytesIO()
image.save(buffer, format=image_format.upper())
buffer.seek(0)
img_bytes = buffer.read()
return Response(
img_bytes,
headers=headers,
status_code=200,
media_type=f"image/{image_format}",
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant