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