mirror of
https://github.com/hiyouga/LLaMA-Factory.git
synced 2025-10-14 23:58:11 +08:00
Force re check.
Former-commit-id: 5f04452f7d65e535d0af08944f7b9e29e85f51d7
This commit is contained in:
parent
2674b42b59
commit
097d031066
@ -14,6 +14,7 @@
|
||||
|
||||
import base64
|
||||
import io
|
||||
import re
|
||||
import json
|
||||
import os
|
||||
import uuid
|
||||
@ -105,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 image_url.startswith("data:image"): # base64 image
|
||||
if re.match("^data:image\/(png|jpg|jpeg|gif|bmp);base64,(.+)$", data_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
|
||||
|
Loading…
x
Reference in New Issue
Block a user