diff --git a/serverless_openai/apis.py b/serverless_openai/apis.py index 37b70f6..0a7238c 100644 --- a/serverless_openai/apis.py +++ b/serverless_openai/apis.py @@ -238,15 +238,26 @@ def vision_longimage( temperature: Optional[float] = 1, max_tokens: Optional[int] = 1024, ) -> OpenAIResults: + + if isinstance(messages.image, list): + img_b64_list = [] + for img in messages.image: + if 'data:image/jpeg;base64' in img: + image_np = b64_to_np(img) + else: + image_np = urlimage_to_np(img) + img_b64_list.extend(crop_image(image_np)) - if isinstance(messages.image, str): + elif isinstance(messages.image, str): if 'data:image/jpeg;base64' in messages.image: image_np = b64_to_np(messages.image) else: image_np = urlimage_to_np(messages.image) + img_b64_list = crop_image(image_np) elif isinstance(messages.image, np.ndarray): image_np = messages.image - img_b64_list = crop_image(image_np) + img_b64_list = crop_image(image_np) + newm = [ { "role": messages.role, diff --git a/setup.py b/setup.py index 0fc8871..e533bf5 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ from setuptools import setup, find_packages -VERSION = '1.3.3' +VERSION = '1.3.4' DESCRIPTION = "A package for using Openai in serverless environment" LONG_DESCRIPTION = 'A package for using Openai with scraping and etc. in serverless application such as AWS Lambda and GCP Cloud Function'