MCPcopy Create free account
hub / github.com/NVIDIA/TensorRT-LLM / load_base64_image

Function load_base64_image

tensorrt_llm/inputs/utils.py:104–114  ·  view source on GitHub ↗
(parsed_url: str)

Source from the content-addressed store, hash-verified

102
103
104def load_base64_image(parsed_url: str) -> Image.Image:
105 data_spec, data = parsed_url.path.split(",", 1)
106 media_type, data_type = data_spec.split(";", 1)
107
108 if data_type != "base64":
109 msg = "Only base64 data URLs are supported for now."
110 raise NotImplementedError(msg)
111
112 content = base64.b64decode(data)
113 image = _load_and_convert_image(BytesIO(content))
114 return image
115
116
117def load_base64_image_embeds(str_content: str) -> torch.Tensor:

Callers 2

load_imageFunction · 0.85
async_load_imageFunction · 0.85

Calls 2

_load_and_convert_imageFunction · 0.85
splitMethod · 0.45

Tested by

no test coverage detected