MCPcopy Index your code
hub / github.com/abetlen/llama-cpp-python / _load_image

Method _load_image

llama_cpp/llama_chat_format.py:3659–3670  ·  view source on GitHub ↗
(image_url: str)

Source from the content-addressed store, hash-verified

3657
3658 @staticmethod
3659 def _load_image(image_url: str) -> bytes:
3660 if image_url.startswith("data:"):
3661 import base64
3662
3663 image_bytes = base64.b64decode(image_url.split(",")[1])
3664 return image_bytes
3665 else:
3666 import urllib.request
3667
3668 with urllib.request.urlopen(image_url) as f:
3669 image_bytes = f.read()
3670 return image_bytes
3671
3672 @staticmethod
3673 def get_image_urls(messages: List[llama_types.ChatCompletionRequestMessage]):

Callers 1

load_imageMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected