问题
I would like to ask you the the following thing about Vision API.
The following picture indicates that I can take on "Free with Label Detection, or $1.50", if I will use "Label Detection". But, I didn't find out how to use both of them at the same time in a tutorial on "Label Detection" and "Safe Search Detection" both.
- Can I use both of services at a time in Python?
- If so, how can I call for them?
I will really appreciate that if you tell me.
回答1:
In case you want to send both types at the same time, you can use the annotate_image()
method; in this way, you can specify all the features that need to be included in the same request. Based on this, I recommend you to take a look on this documentation (Doc1, Doc2) to get detailed information about this property usage, as well as this tutorial, that contains a curl
command example where is shown the process required to send multiple features within the same call that you can use as an alternative workaround.
import io
import os
from google.cloud import vision
client = vision.ImageAnnotatorClient()
response = client.annotate_image({
'image': {'source': {'image_uri': '<IMAGE_URI>'}},
'features': [{'type': vision.enums.Feature.Type.SAFE_SEARCH_DETECTION},
{'type': vision.enums.Feature.Type.LABEL_DETECTION}]
})
print(response)
Additionally, I think that this pricing information refers that you can use the Safe Search Detection feature for free if you use it with Label Detection; however, the Label Detection requests will be billed with the corresponding charges that are displayed at the Prices document.
来源:https://stackoverflow.com/questions/53195930/how-to-call-for-label-detection-and-safe-search-detection-at-a-time-on-googl