diff --git a/flytekit/types/file/image.py b/flytekit/types/file/image.py index 22d8f3b484..d26389cf99 100644 --- a/flytekit/types/file/image.py +++ b/flytekit/types/file/image.py @@ -10,7 +10,6 @@ from flytekit.models.literals import Blob, BlobMetadata, Literal, Scalar from flytekit.models.types import LiteralType - T = typing.TypeVar("T") @@ -73,6 +72,7 @@ def guess_python_type(self, literal_type: LiteralType) -> Type[T]: def to_html(self, ctx: FlyteContext, python_val: PIL.Image.Image, expected_python_type: Type[T]) -> str: import base64 from io import BytesIO + buffered = BytesIO() python_val.save(buffered, format="PNG") img_base64 = base64.b64encode(buffered.getvalue()).decode() diff --git a/tests/flytekit/unit/types/file/test_image.py b/tests/flytekit/unit/types/file/test_image.py index 60a36544ef..5163162e00 100644 --- a/tests/flytekit/unit/types/file/test_image.py +++ b/tests/flytekit/unit/types/file/test_image.py @@ -1,6 +1,7 @@ -from flytekit import task, workflow import PIL.Image +from flytekit import task, workflow + @task(disable_deck=False) def t1() -> PIL.Image.Image: