MCPcopy
hub / github.com/ModelTC/LightLLM / image_to_base64

Function image_to_base64

test/test_api/test_multimodal_api.py:102–105  ·  view source on GitHub ↗
(image)

Source from the content-addressed store, hash-verified

100
101
102def image_to_base64(image):
103 with open(image, "rb") as fin:
104 encoded_string = base64.b64encode(fin.read()).decode("utf-8")
105 return encoded_string
106
107
108# Please replace the question template as QUESTION_TEMPLATES:

Callers 1

Calls 2

decodeMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected