layout-parser icon indicating copy to clipboard operation
layout-parser copied to clipboard

gcv_agent.py bugs: 'google.cloud.vision' has no attribute 'types'

Open Andrew-Kao opened this issue 2 years ago • 1 comments

Describe the bug

On initializing the gcv_agent, the following error occurs: AttributeError: module 'google.cloud.vision' has no attribute 'types' This error is thrown at line 119 of layoutparser/ocr/gcv_agent.py: self._context = _vision.types.ImageContext(language_hints=languages) Editing line 119 to this fixes it: self._context = _vision.ImageContext(language_hints=languages)

The same goes for line 134: img_content = _vision.types.Image(content=img_content) which runs correctly when modified to: img_content = _vision.Image(content=img_content)

To Reproduce

  1. This occurs if you follow the tutorial: https://layout-parser.readthedocs.io/en/latest/example/parse_ocr/index.html#initiate-gcv-ocr-engine-and-check-the-image at the step where the ocr_agent is initialized

Environment Platform is MacOS with LayoutParser 0.3.4

Andrew-Kao avatar Feb 23 '23 03:02 Andrew-Kao

same here

'GCVAgent' object has no attribute '_client'

wr0124 avatar Jun 06 '23 13:06 wr0124