From e4903968a3d05c378a2d202ac88c0dbadd3d774b Mon Sep 17 00:00:00 2001 From: Liuweiqing <121866954+14790897@users.noreply.github.com> Date: Tue, 1 Aug 2023 16:13:40 +0800 Subject: [PATCH] img_save --- scripts/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/api.py b/scripts/api.py index b0fef36..4d094ee 100644 --- a/scripts/api.py +++ b/scripts/api.py @@ -67,7 +67,7 @@ def pbrem_api(_: gr.Blocks, app: FastAPI): def encode_pil_to_base64(img: Image) -> str: # First, you need to save your PIL Image object to an in-memory file: buffer = io.BytesIO() - Image.fromarray(img.astype('uint8'), 'RGBA').save(buffer, format="PNG") + img.save(buffer, format="PNG") # Then, get the content of the file: img_str = buffer.getvalue()