gpt4 book ai didi

google-cloud-platform - "We can not access the URL currently."

转载 作者:行者123 更新时间:2023-12-01 23:52:49 25 4
gpt4 key购买 nike

当返回“我们当前无法访问该 URL”时,我调用 google api。但资源必须存在并且可以访问。

https://vision.googleapis.com/v1/images:annotate

请求内容:

{
"requests": [
{
"image": {
"source": {
"imageUri": "http://yun.jybdfx.com/static/img/homebg.jpg"
}
},
"features": [
{
"type": "TEXT_DETECTION"
}
],
"imageContext": {
"languageHints": [
"zh"
]
}
}
]
}

回复内容:

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

最佳答案

截至 2017 年 8 月,这是 Google Cloud Vision API ( source ) 的一个已知问题。它似乎对某些用户来说是重现的,但不是确定性的,我自己也遇到过很多图像。

当前的解决方法包括将您的内容上传到 Google Cloud Storage 并传递其 gs://uri(注意它不必在 GCS 上公开可读),或者在本地下载图像并以 base64 格式将其传递到视觉 API .

这是后一种方法的 Node.js 示例:

const request = require('request-promise-native').defaults({
encoding: 'base64'
})

const data = await request(image)

const response = await client.annotateImage({
image: {
content: data
},
features: [
{ type: vision.v1.types.Feature.Type.LABEL_DETECTION },
{ type: vision.v1.types.Feature.Type.CROP_HINTS }
]
})

关于google-cloud-platform - "We can not access the URL currently.",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45119587/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com