如何让 AI Platform 部署的模型可公开访问?

How can I make AI Platform deployed model publicly accessible?

我已经创建了一个模型并将其部署到 Cloud AI Platform Predictions (ML Engine)。

如何使 REST 端点可公开访问?现在,它仅在我的项目中可见。

首先创建一个policy.yaml,内容如下:

bindings:
- members:
  - group:allAuthenticatedUsers
  role: roles/ml.modelUser

然后,设置模型的IAM策略:

gcloud ai-platform models set-iam-policy my_model --project=my_project policy.yaml 

您可以使用相同的方法来限制来自特定域的特定 Google 组用户

bindings:
- members:
  - group:admins@example.com
  - domain:example.com
  role: roles/ml.modelUser
- members:
  - user:sean@example.com
  role: roles/ml.modelUser