From bd0f3b405014254c9c8131c96625fe7b6a84ffa4 Mon Sep 17 00:00:00 2001 From: marko1616 <45327989+marko1616@users.noreply.github.com> Date: Tue, 27 Aug 2024 11:27:56 +0800 Subject: [PATCH] Update chat.py Former-commit-id: 4e5893a5c4a47ff3cb989bbef0841effc713fc08 --- src/llamafactory/api/chat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/llamafactory/api/chat.py b/src/llamafactory/api/chat.py index 1f0c1e95..74b56f73 100644 --- a/src/llamafactory/api/chat.py +++ b/src/llamafactory/api/chat.py @@ -106,7 +106,7 @@ def _process_request( input_messages.append({"role": ROLE_MAPPING[message.role], "content": input_item.text}) else: image_url = input_item.image_url.url - if re.match("^data:image\/(png|jpg|jpeg|gif|bmp);base64,(.+)$", data_url): + if re.match("^data:image\/(png|jpg|jpeg|gif|bmp);base64,(.+)$", image_url): image_data = base64.b64decode(image_url.split(",", maxsplit=1)[1]) image_path = io.BytesIO(image_data) elif os.path.isfile(image_url): # local file