如何使用Google AI平台在线预测? [英] how to use google AI platform online predictions?
本文介绍了如何使用Google AI平台在线预测?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
解决方案
您可以使用gcloud获取身份验证令牌:
access_token = $(gcloud身份验证应用程序-默认打印访问令牌)
,然后将其嵌入到标题中:
curl --silent \-H授权:承载$ access_token" \-H内容类型:application/json" \-X POST \
等
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?
解决方案
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.
这篇关于如何使用Google AI平台在线预测?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文