在 Google Cloud Vision API 中指定响应语言

Specify language for response in Google Cloud Vision API

我正在使用 Google Cloud Vision API 从给定图像中检测地标、webEntities 和其他东西(查看文档 here),我专门使用images:annotate端点,我想指定语言,我希望返回结果是英文的。

有什么办法可以实现吗?

this document states that the only language for retrieved labels is English and you can use Cloud Translation API to translate it into other language. About specifying language in Vision API, as far as I know, one can give language hint for TEXT_DETECTION as explained in this document 但我不知道在非文本检测中指定语言。

image_context 添加到响应中,您应该已准备就绪。

response = client.text_detection(
    image=image,
    image_context={"language_hints": ["bn"]},  # Bengali
)