【问题标题】:In google cloud vision API while calling client.text_detection() getting TypeError: type object got multiple values for keyword argument 'features'在谷歌云视觉 API 中调用 client.text_detection() 获取 TypeError: type object got multiple values for keyword argument 'features'
【发布时间】:2021-04-06 01:23:41
【问题描述】:

我在函数中使用了以下代码,我正在返回响应

     image = vision.types.Image(content=content)
     print("vision type: %s" %vision.enums.Feature.Type.DOCUMENT_TEXT_DETECTION)
     feature = vision.types.Feature(type=vision.enums.Feature.Type.DOCUMENT_TEXT_DETECTION)
     print(type(feature))
     response = client.text_detection(image=image,features= 
     [{'type':str(vision.enums.Feature.Type.TEXT_DETECTION)}], image_context= 
     {"language_hints": 
     ["en"]})

Error at this line: 
response = client.text_detection(image=image,features= 
[{'type':str(vision.enums.Feature.Type.TEXT_DETECTION)}], image_context={"language_hints": 
["en"]})
request = dict(image=image, features=[copied_features], **kwargs)
TypeError: type object got multiple values for keyword argument 'features'

注意: 我访问过他们的文档页面,但是那已经过时了,我特别想将功能类型设置为“DOCUMENT_TEXT_DETECTION”或“TEXT_DETECTION”

【问题讨论】:

    标签: ocr google-cloud-vision


    【解决方案1】:

    改成:

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

    您已在此请求中包含 text_detection,您正在尝试重新设置。 Example

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-07-06
      • 2022-11-11
      • 1970-01-01
      • 2021-01-19
      • 1970-01-01
      • 2022-01-12
      相关资源
      最近更新 更多