Google Cloud Vision API在太平洋标准时间下午1点之前无法访问图像url



我正在使用谷歌云视觉API安全搜索功能。我通过将url传递给远程图像来调用API。

我注意到相同的图像URL在PST下午1点之前失败,它在大约下午1点之后工作。我已经注意到这种模式三天了。

失败的消息(在1PM之前)看起来像这样:

"error": {
"code": 14,
"message": "We can not access the URL currently. Please download the content and pass it in."
}

当它正常工作时(下午1点之后),我可以得到这样的预期响应:

"adult": "UNLIKELY",
"spoof": "UNLIKELY",
"medical": "UNLIKELY",
"violence": "UNLIKELY",
"racy": "LIKELY"
}

还有其他人遇到过类似的问题吗?我还在用免费套餐,不知道这是不是问题。

编辑:添加响应-

{
"responses": [
{
"error": {
"code": 14,
"message": "We can not access the URL currently. Please download the content and pass it in."
}
},
{
"error": {
"code": 4,
"message": "We can not access the URL currently. Please download the content and pass it in."
}
},
{
"error": {
"code": 14,
"message": "We can not access the URL currently. Please download the content and pass it in."
}
},
{
"safeSearchAnnotation": {
"adult": "LIKELY",
"spoof": "VERY_UNLIKELY",
"medical": "UNLIKELY",
"violence": "UNLIKELY",
"racy": "VERY_LIKELY"
}
},
{
"error": {
"code": 4,
"message": "We can not access the URL currently. Please download the content and pass it in."
}
},
{
"safeSearchAnnotation": {
"adult": "UNLIKELY",
"spoof": "VERY_UNLIKELY",
"medical": "UNLIKELY",
"violence": "VERY_UNLIKELY",
"racy": "VERY_LIKELY"
}
},
{
"error": {
"code": 14,
"message": "We can not access the URL currently. Please download the content and pass it in."
}
},
{
"error": {
"code": 14,
"message": "We can not access the URL currently. Please download the content and pass it in."
}
},
{
"error": {
"code": 4,
"message": "We can not access the URL currently. Please download the content and pass it in."
}
},
{
"safeSearchAnnotation": {
"adult": "VERY_UNLIKELY",
"spoof": "VERY_UNLIKELY",
"medical": "VERY_UNLIKELY",
"violence": "VERY_UNLIKELY",
"racy": "POSSIBLE"
}
},
{
"safeSearchAnnotation": {
"adult": "POSSIBLE",
"spoof": "VERY_LIKELY",
"medical": "UNLIKELY",
"violence": "UNLIKELY",
"racy": "VERY_LIKELY"
}
},
{
"error": {
"code": 4,
"message": "We can not access the URL currently. Please download the content and pass it in."
}
},
{
"safeSearchAnnotation": {
"adult": "UNLIKELY",
"spoof": "LIKELY",
"medical": "UNLIKELY",
"violence": "UNLIKELY",
"racy": "POSSIBLE"
}
},
{
"safeSearchAnnotation": {
"adult": "POSSIBLE",
"spoof": "POSSIBLE",
"medical": "VERY_UNLIKELY",
"violence": "UNLIKELY",
"racy": "VERY_LIKELY"
}
},
{
"error": {
"code": 4,
"message": "We can not access the URL currently. Please download the content and pass it in."
}
},
{
"error": {
"code": 14,
"message": "We can not access the URL currently. Please download the content and pass it in."
}
}
]
}
200 OK

如果您使用的是公开可用的url,您将不时遇到此错误,因为不能保证图像随时可用。镜像的主机可能会拒绝一些DOS防御请求。详细信息请参见imageUri参考。

imageUri

源图像的URI。可以是:

  1. 形式为gs://bucket_name/object_name的Google云存储URI。不支持对象版本控制。参见Google云存储请求获取更多信息。

  2. 可公开访问的图像HTTP/HTTPS URL。从HTTP/HTTPS url,谷歌不能保证请求将被完成。您的请求可能失败,如果指定的主机拒绝请求(例如,由于请求节流或DOS预防),或者如果Google限制对网站的请求以防止滥用。你应该生产应用程序不依赖于外部托管的映像。

当同时指定gcsImageUri和imageUri时,imageUri取优先。

我的建议是在本地下载图像或将其放在云存储中,从那里你可以使用它作为输入。

相关内容

  • 没有找到相关文章

最新更新