mirror of
https://github.com/hiyouga/LLaMA-Factory.git
synced 2025-08-23 06:12:50 +08:00
add image input type
Former-commit-id: ffa39ba3db0dbfd375cdf20b9f3cbecd359be1a1
This commit is contained in:
parent
2360d63ebc
commit
1598e5d355
@ -30,7 +30,7 @@ if TYPE_CHECKING:
|
||||
path: Optional[str]
|
||||
bytes: Optional[bytes]
|
||||
|
||||
ImageInput = Union[str, EncodedImage, ImageObject]
|
||||
ImageInput = Union[str, bytes, EncodedImage, ImageObject]
|
||||
VideoInput = str
|
||||
|
||||
|
||||
@ -104,6 +104,8 @@ class BasePlugin:
|
||||
for image in images:
|
||||
if isinstance(image, str):
|
||||
image = Image.open(image)
|
||||
elif isinstance(image, bytes):
|
||||
image = Image.open(BytesIO(image))
|
||||
elif isinstance(image, dict):
|
||||
if image["bytes"] is not None:
|
||||
image = Image.open(BytesIO(image["bytes"]))
|
||||
|
Loading…
x
Reference in New Issue
Block a user