From f09d883b2e1aa2ad813e48f7bb22708964a0775d Mon Sep 17 00:00:00 2001 From: Heiru Wu Date: Tue, 10 Sep 2024 05:38:21 +0800 Subject: [PATCH] fix(ray): append mime type for image output --- instill/helpers/ray_io.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/instill/helpers/ray_io.py b/instill/helpers/ray_io.py index 2a33bce..e39d209 100644 --- a/instill/helpers/ray_io.py +++ b/instill/helpers/ray_io.py @@ -905,7 +905,8 @@ def construct_task_text_to_image_output( """Construct trigger output for text to image task Args: - images (List[List[str]]): for each input prompt, the generated images with the length of `samples` + images (List[List[str]]): for each input prompt, + the generated jpeg image base64 string with the length of `samples` """ if not len(finish_reasons) == len(images): @@ -922,7 +923,7 @@ def construct_task_text_to_image_output( choices.append( { "finish-reason": finish, - "image": img, + "image": f"data:image/jpeg;base64,{img}", } ) data["choices"] = choices