MCPcopy Create free account
hub / github.com/CodeGoat24/UniGenBench / local_image_to_data_url

Function local_image_to_data_url

eval/src/eval_common.py:191–198  ·  view source on GitHub ↗

Convert a local image file to a base64-encoded data URL.

(image_path)

Source from the content-addressed store, hash-verified

189# ============================================================
190
191def local_image_to_data_url(image_path):
192 """Convert a local image file to a base64-encoded data URL."""
193 mime_type, _ = guess_type(image_path)
194 if mime_type is None:
195 mime_type = "application/octet-stream"
196 with open(image_path, "rb") as f:
197 encoded = base64.b64encode(f.read()).decode("utf-8")
198 return f"data:{mime_type};base64,{encoded}"
199
200
201def build_system_prompt(prompt, testpoint, test_desc, lang):

Callers 1

call_evaluation_geminiFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected