MCPcopy
hub / github.com/mudler/LocalAI / load_image

Method load_image

backend/python/vllm/backend.py:854–871  ·  view source on GitHub ↗

Load an image from the given file path or base64 encoded data. Args: image_path (str): The path to the image file or base64 encoded data. Returns: Image: The loaded image.

(self, image_path: str)

Source from the content-addressed store, hash-verified

852 )
853
854 def load_image(self, image_path: str):
855 """
856 Load an image from the given file path or base64 encoded data.
857
858 Args:
859 image_path (str): The path to the image file or base64 encoded data.
860
861 Returns:
862 Image: The loaded image.
863 """
864 try:
865
866 image_data = base64.b64decode(image_path)
867 image = Image.open(io.BytesIO(image_data))
868 return image
869 except Exception as e:
870 print(f"Error loading image {image_path}: {e}", file=sys.stderr)
871 return None
872
873 def load_video(self, video_path: str):
874 """

Callers 1

_predictMethod · 0.95

Calls 1

openMethod · 0.80

Tested by

no test coverage detected