有没有一种方法可以将Google Vision API-AutoML从一个项目共享给其他项目?

时间:2019-09-17 17:00:11

标签: node.js firebase google-vision google-cloud-automl

我从一个Firebase项目中,在GCloud控制台中开发了一个自动ML模型和有效的Google视觉API。一切正常。 (请参见下面的代码)

现在,我需要创建其他Firebase项目,这些项目应使用第一个相同的API。

因此,我如何继续在多个项目中继续使用此API,而不仅是在第一个(所有者)项目中。有可能吗?

我试图将第二个项目中的Auto ML服务帐户包括在IAM中的第一个项目中,但没有成功。错误为:“错误:7 PERMISSION_DENIED:呼叫者没有权限”

有人可以帮助我吗?

谢谢!


const automl = require('@google-cloud/automl');
const predictionClient = new automl.PredictionServiceClient();

const requestBody = {
    name: predictionClient.modelPath(firstProjectID, region, modelID),
    payload: {
      "image": {
        "imageBytes": picture
      }
    }
}

return predictionClient.predict(requestBody)
    .then(responses => { 
        let response = responses[0];
        return console.log(response.payload[0].classification.score)
        }).catch(err => {
           console.error(err);
        });
    });

0 个答案:

没有答案