Layout-Parser / layout-parser

A Unified Toolkit for Deep Learning Based Document Image Analysis
https://layout-parser.github.io/
Apache License 2.0
4.64k stars 449 forks source link

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

Open Andrew-Kao opened 1 year ago

Andrew-Kao commented 1 year ago

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

wr0124 commented 1 year ago

same here

'GCVAgent' object has no attribute '_client'