Retrieving numpy array of an instance using lua


The image_response is actually a sequence of bytes even if lua says it is a string. To include a sequence of bytes into a json payload, you must encode it in base64.

An alternative is to modify your Fast API to receive the sequence of bytes with the numpy array as the payload and get the instance_id in the API route. That would give something like this (disclaimer: not tested)

function OnStoredInstance(instanceId, tags, metadata, origin)
local numpy = RestApiGet(‘/instances/’ … instanceId … ‘/numpy’)

local response = HttpPost(“” … instanceId, numpy)

print(“Response” …response)