"We are unable to access the URL at this time."

I call the google api when "We cannot access the url at present" returns. But resources must exist and may be available.

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

request content:

{
  "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."
      }
    }
  ]
}
+4
source share
3 answers

The request itself works for me. It is possible that the image host was temporarily down and / or had problems on their side. If you repeat the request, it will work mainly for you.

0
source

2017 API Google Cloud Vision (source). , , , .

Google, gs://uri ( , GCS) API base64.

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 }
  ]
})
0

Google Cloud URI.

0

Source: https://habr.com/ru/post/1681515/


All Articles