Skip to content

Commit

Permalink
fix: image format
Browse files Browse the repository at this point in the history
Signed-off-by: Frost Ming <[email protected]>
  • Loading branch information
frostming committed Feb 1, 2024
1 parent bde63b7 commit 6160d05
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/_bentoml_sdk/io_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,11 @@ def content_stream() -> t.Generator[str | bytes, None, None]:
)
else: # is PIL Image
buffer = io.BytesIO()
obj.save(buffer, format=obj.format)
image_format = obj.format or "PNG"
obj.save(buffer, format=image_format)
return Response(
content=buffer.getvalue(),
media_type=f"image/{obj.format.lower()}",
media_type=f"image/{image_format.lower()}",
)

if not isinstance(obj, RootModel):
Expand Down

0 comments on commit 6160d05

Please sign in to comment.