Hi,
I am doing a learning certification for GCP machine learning engineer and I am unable to complete one of the exercises. The details are as follows
Exercise
Create a JSON request file for submitting the base64 encoded form for processing:
Note
Replace my-bucket-name with the name of your storage bucket.
{ "requests": [ { "image": { "source": { "gcsImageUri": "gs://my-bucket-name/donuts.png" } }, "features": [ { "type": "LABEL_DETECTION", "maxResults": 10 } ] } ] }
I replace my project id (name of my bucket )for the "my-bucket-name"
I get the following response in Shell
bash: requests:: command not found
-bash: image:: command not found
-bash: source:: command not found
-bash: gcsImageUri:: command not found
-bash: },: command not found
-bash: features:: command not found
-bash: type:: command not found
-bash: maxResults:: command not found
-bash: ]: command not found
-bash: ]: command not found
-bash: syntax error near unexpected token `}'
Hello achand11,
Welcome to Google Cloud Community!
Based on the documentation of Cloud Vision API in Creating a request JSON under field value details we need to use image.content to pass a base64 encoded string representation of an image.
The code should be:
{
"requests": [
{
"image": {
"content": "gs://my-bucket-name/donuts.png"
},
"features": [
{
"type": "LABEL_DETECTION",
"maxResults": 10
}
]
}
]
}
But before anything else we need to make an image annotation request we must be aware of the exact file path of our image. Instead of using your project id for replacing my-bucket-name try to navigate your exact file path for the gcsImageUri.
I hope the above information is helpful.