MCPcopy Create free account
hub / github.com/ModelTC/LightX2V / process_image_path

Function process_image_path

scripts/server/post_multi_servers.py:19–31  ·  view source on GitHub ↗

Process image_path: convert to base64 if local path, keep unchanged if HTTP link

(image_path)

Source from the content-addressed store, hash-verified

17 return base64.b64encode(image_data).decode("utf-8")
18
19
20def process_image_path(image_path) -> Any | str:
21 """Process image_path: convert to base64 if local path, keep unchanged if HTTP link"""
22 if isinstance(image_path, list):
23 return [process_image_path(path) for path in image_path]
24 if not image_path:
25 return image_path
26
27 if image_path.startswith(("http://", "https://")):
28 return image_path
29
30 if os.path.exists(image_path):
31 return image_to_base64(image_path)
32 else:
33 logger.warning(f"Image path not found: {image_path}")
34 return image_path

Callers 1

send_and_monitor_taskFunction · 0.85

Calls 2

warningMethod · 0.80
image_to_base64Function · 0.70

Tested by

no test coverage detected