Tanvi Kulkarni
Tanvi Kulkarni

Reputation: 1

Google vison response access changes in different system(using python)

I am using Google vision API for text annotations, but why in some systems, the system accepts this response.full_text_annotation.pages of Google vision, and in some systems it accepts this response["fullTextAnnotation"]["pages"] of Google vision?

Why is this so?, because of it I have to change the code again and again just to iterate over the response, in different systems.

for page in response["fullTextAnnotation"]["pages"]:
  for block in page["blocks"]:
     for paragraph in block["paragraphs"]:
        for word in paragraph["words"]:
           print(word)

-> but in some systems, the method it allows to iterate is 

for text in response.full_text_annotation.pages:
   for block in text.blocks:
       for para in block.paragraphs:
          for word in para.words:
             print(word)

Upvotes: 0

Views: 18

Answers (0)

Related Questions