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

Eur*_*tré 2 android google-cloud-platform google-cloud-vision

我正在使用 Google Cloud Vision API 来检测给定图像中的地标、网络实体和其他内容(请查看此处的文档),我专门使用 images:annotate 端点,并且我想指定语言,我想要返回结果为英文。

我有办法实现这一目标吗?

Ram*_*i.K 7

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

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