Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'GCVAgent' object has no attribute '_client' #111

Closed
junxi-liu opened this issue Jan 8, 2022 · 8 comments
Closed

'GCVAgent' object has no attribute '_client' #111

junxi-liu opened this issue Jan 8, 2022 · 8 comments
Labels
bug Something isn't working

Comments

@junxi-liu
Copy link

Hi, when I was running the tutorial of "OCR tables and parse the output", when I was trying to obtain the result:

res = ocr_agent.detect(image, return_response=True)

The response was

Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/layoutparser/ocr/gcv_agent.py", line 168, in detect res = self._detect(img_content) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/layoutparser/ocr/gcv_agent.py", line 134, in _detect response = self._client.document_text_detection( AttributeError: 'GCVAgent' object has no attribute '_client'

I googled and some sites said The Client() class was removed in the Client Library v0.25.1 and replaced with ImageAnnotatorClient().

Was this a problem? Thank you.

@junxi-liu junxi-liu added the bug Something isn't working label Jan 8, 2022
@its-kind-of
Copy link

Could you please share your solution with me? I'm experiencing the same problem.
AttributeError: 'GCVAgent' object has no attribute 'client'

@dokd233622
Copy link

Same here..

@bsuresh14061992
Copy link

send me the code please

@wgfsophia
Copy link

same here

2 similar comments
@dadasmash
Copy link

same here

@Keitaro-Ninomiya
Copy link

same here

@JOKERKING88
Copy link

AttributeError: 'GCVAgent' object has no attribute '_client'

@JOKERKING88
Copy link

This is not a bug: it just says that your google credentials are wrong. As seen in the documentation:
https://layout-parser.readthedocs.io/en/stable/example/parse_ocr/index.html
ocr_agent = lp.GCVAgent.with_credential("<path/to/your/credential>",
languages = ['en'])
The <path/to/your/credential> part is what causing this error: you should go to Google Cloud Vision and create a new credential and download it as json file like this one: /Users/Downloads/XXXXX-YYYY-99889988-zz987656abc88.json
Then the OCR agent should be:
ocr_agent = lp.GCVAgent.with_credential("/Users/Downloads/XXXXX-YYYY-99889988-zz987656abc88.json",
languages = ['en'])
please read:
https://cloud.google.com/functions/docs/tutorials/ocr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

8 participants