MCPcopy Create free account
hub / github.com/CCCpan/ai-api-integration / image_to_data_url

Function image_to_data_url

examples/python/vision.py:25–28  ·  view source on GitHub ↗
(path: str)

Source from the content-addressed store, hash-verified

23
24# 方法 2:本地图片转 base64
25def image_to_data_url(path: str) -> str:
26 with open(path, "rb") as f:
27 b64 = base64.b64encode(f.read()).decode()
28 return f"data:image/jpeg;base64,{b64}"
29
30resp = client.chat.completions.create(
31 model="gpt-5",

Callers 1

vision.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected