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