【发布时间】:2020-06-15 20:51:45
【问题描述】:
我正在研究 Google Cloud AutoML 视觉对象检测。 我正在关注下面的教程https://cloud.google.com/vision/automl/object-detection/docs/prepare
由于我想要一个自定义模型,我创建了一个新数据集并对其进行了训练。在训练期间,它要求为我的模型在 Cloud Hosted 或 Edge 之间进行选择。我选择了云托管。
要使用此云托管模型/预测图像,我们需要从我们端进行 Rest API 调用。在本教程中,提到了如何在各种客户端库中进行这些 Rest API 调用,而不是在 Swift 中。我想知道如何从 iOS 应用程序通过 Swift 进行此 Rest API 调用。
如何执行 REST API?
给出关于 Rest API 的信息
request.json
{
"payload": {
"image": {
"imageBytes": "YOUR_IMAGE_BYTE"
},
}
}
执行请求
curl -X POST -H "Content-Type: application/json" \
-H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
https://automl.googleapis.com/v1beta1/projects/drughk-9747d/locations/us-central1/models/ICN6566958205491349320:predict -d @request.json
【问题讨论】:
标签: ios swift google-cloud-platform google-api google-cloud-firestore