Kero
Kero

Reputation: 1954

how to use google AI platform online predictions?

i created a custom tensorflow model and deployed to google cloud AI platform however, when i sent a post request to online prediction api (https://ml.googleapis.com/v1/projects/my-project/models/my-model/versions/my-version:predict). i got back 401 Request is missing required authentication credential. Expected OAuth 2 access token my understand that by deploying model is its API already available online, so is there away to make API public? if not how i can make api authentication through bearer token?

Upvotes: 2

Views: 1002

Answers (1)

Lak
Lak

Reputation: 4166

You can get the auth token using gcloud:

access_token=$(gcloud auth application-default print-access-token)

and then embed it into the header:

curl --silent \
    -H "Authorization: Bearer $access_token"  \
    -H "Content-Type: application/json" \
    -X POST \

etc.

Upvotes: 3

Related Questions