0

如何修改以下 Python 代码以返回德语结果?是否可以?谢谢你。

def detect_text_uri(uri):
    """Detects text in the file located in Google Cloud Storage or on the Web.
    """
    client = vision.ImageAnnotatorClient()
    image = types.Image()
    image.source.image_uri = uri

    response = client.text_detection(image=image)
    texts = response.text_annotations
    print('Texts:')

    for text in texts:
        print('\n"{}"'.format(text.description))

        vertices = (['({},{})'.format(vertex.x, vertex.y)
                for vertex in text.bounding_poly.vertices])

        print('bounds: {}'.format(','.join(vertices)))
4

1 回答 1

0

是的,您可以使用"languageHints": [ "de"]

{
  "requests": [
    {
      "imageContext": {
        "languageHints": ["de"]
      }
    }
  ]
}

对于所有类型的语言代码,请检查支持的 Google 视觉语言

于 2018-03-05T14:17:18.233 回答