INNER CODE UNIT · Python
has_base64_image
dusty-nv/jetson-containers · packages/vlm/vila-microservice/src/main.py:71
def has_base64_image(message):
"""Check if a message contains a base64 encoded image."""
if not hasattr(message, 'messages'):
return False
for msg in message.messages:
if msg.role == "user" and isinstance(msg.content, list):
for content in msg.content:
if content.type == "image_url" and hasattr(content, "image_url"):
url = content.image_url.url
if url.startswith("data:image/"):
return True
return False
#REST API Queue
cmd_q = Queue() #commands are put in by REST API requests and taken out by main loop
cmd_resp = dict() #responses to commands will be put in a shared dict based on command UUID