0

I'm getting this error:

error": { "code": 400, "message": "Invalid value at 'requests[0].image.content' (TYPE_BYTES), \"000002.jpg\"", "status": "INVALID_ARGUMENT", "details": [ { "@type": "type.googleapis.com/google.rpc.BadRequest"

And it may have something to do with the encoding of the images, not sure. I am sending Google a bunch of .jpgs.

Note that this is similar to this question, but that one doesn't help a whole lot - there's no answer.

Here's my JSON:

for f in $FILES do echo "Original file name is $f" response=$(curl -v -H "Accept: application/json" -H "Content-type:
application/json" -X POST -d '{"requests":[ { "image":{ "content":"'"$f"'" }, "features":[ { "type":"LABEL_DETECTION", "maxResults":3 } ] }]}' $baseURL) echo $response done

This is the first image I send it. enter image description here

Any thoughts on what's causing this?

Community
  • 1
  • 1
JohnAllen
  • 7,317
  • 9
  • 41
  • 65

1 Answers1

2

You need to send the base64 encoded representation of the image, not the filename.

Rahul
  • 12,181
  • 5
  • 43
  • 64