I am trying to use Tensorflow serving to host my model and get predictions on image data. REST API requires binary inputs to be encoded as Base64 and wrapped in an object containing 'b64' key. Therefore, I give the encoded image to the curl request using the 'b64' key. However, when I tried executing the command, I am getting an error 'Unable to base64 decode'. Here is the code that I ran:
curl -X POST http://localhost:9001/v1/models/sanskrit:predict -H 'cache-control: no-cache' -H 'content-type: application/json' -d '{"signature_name": "serving_default", "inputs": {"input": { "b64": "$( base64 /data2/hdia_ocr_data/data/books2/books_3p/nirnaya_sindhu/61/2.jpg)" }}}'
I have also tried to pass base64 string directly to the 'b64' key as shown below:
curl -X POST http://localhost:9001/v1/models/sanskrit:predict -H 'cache-control: no-cache' -H 'content-type: application/json' -d '{"signature_name": "serving_default", "inputs": {"input": { "b64": "<base64_of_image>" }}}'
But this gives an error curl: argument list too long. This is probably because of my image data large size(~200kb). And it is working for images with a smaller size.
Am I missing something while executing these commands?