pull/52/head
Liuweiqing 2023-08-01 16:13:40 +08:00
parent cf332c61c7
commit e4903968a3
1 changed files with 1 additions and 1 deletions

View File

@ -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()