layout-parser
layout-parser copied to clipboard
gcv_agent.py bugs: 'google.cloud.vision' has no attribute 'types'
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
- 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_agentis initialized
Environment Platform is MacOS with LayoutParser 0.3.4
same here
'GCVAgent' object has no attribute '_client'