3

I'm calling the auto ml api to get a prediction but I have the following error :

AutoML API Error:  { Error: 5 NOT_FOUND: Invalid resource ID
at Object.exports.createStatusError (/srv/node_modules/grpc/src/common.js:91:15)
at Object.onReceiveStatus (/srv/node_modules/grpc/src/client_interceptors.js:1209:28)
at InterceptingListener._callNext (/srv/node_modules/grpc/src/client_interceptors.js:568:42)
at InterceptingListener.onReceiveStatus (/srv/node_modules/grpc/src/client_interceptors.js:618:8)
at callback (/srv/node_modules/grpc/src/client_interceptors.js:847:24)

code: 5,metadata: Metadata {_internal_repr: { 'grpc-server-stats-bin': [Array] },flags: 0 },details: 'Invalid resource ID' }

My code is the following :

function callAutoMLAPI(b64img) {
return new Promise((resolve, reject) => {
    const payload = {
        "image": {
          "imageBytes": b64img
        }
      }
    const reqBody = {
        name: predictionClient.modelPath(project, region, automl_model),
        payload: payload
    }
    console.log('ReqBody: ',reqBody);
    predictionClient.predict(reqBody)
        .then(responses => {
            console.log('Got a prediction from AutoML API!', JSON.stringify(responses));
            resolve(responses);
            return null;
        })
        .catch(err => {
            console.log('AutoML API Error: ',err);
            reject(err);
        });
    });    
}

I think it happens because my location or modelId is incorrect, but I don't know where to find my model location and my modelId

1 Answers1

1

As said here "The model name has the format projects/{project-id}/locations/us-central1/models/{model-id}; the model ID is the element that appears after models/ in the "name" value of the response."

This means it is the ID under the model page.

Soni Sol
  • 2,367
  • 3
  • 12
  • 23