class_docstr: A wrapper for `Google Cloud Vision (GCV) <https://cloud.google.com/vision>`_ Text
  Detection APIs.
  
  Note:
      Google Cloud Vision API returns the output text in two types:
  
      * `text_annotations`:
  
          In this format, GCV automatically find the best aggregation
          level for the text, and return the results in a list. We use
          :obj:`~gather_text_annotations` to reterive this type of
          information.
  
      * `full_text_annotation`:
  
          To support better user control, GCV also provides the
          `full_text_annotation` output, where it returns the hierarchical
          structure of the output text. To process this output, we provide
          the :obj:`~gather_full_text_annotation` function to aggregate the
          texts of the given aggregation level.
class_docstr_tok: ["A","wrapper","for","`","Google","Cloud","Vision","(","GCV",")","<","https",":","\/\/cloud.google.com\/vision",">","`","_","Text","Detection","APIs",".","Note",":","Google","Cloud","Vision","API","returns","the","output","text","in","two","types",":","*","`","text_annotations","`",":","In","this","format",",","GCV","automatically","find","the","best","aggregation","level","for","the","text",",","and","return","the","results","in","a","list",".","We","use",":","obj",":","`","~gather_text_annotations","`","to","reterive","this","type","of","information",".","*","`","full_text_annotation","`",":","To","support","better","user","control",",","GCV","also","provides","the","`","full_text_annotation","`","output",",","where","it","returns","the","hierarchical","structure","of","the","output","text",".","To","process","this","output",",","we","provide","the",":","obj",":","`","~gather_full_text_annotation","`","function","to","aggregate","the","texts","of","the","given","aggregation","level","."]
docstr: Send the input image for OCR.
  
  Args:
      image (:obj:`np.ndarray` or :obj:`str`):
          The input image array or the name of the image file
      return_response (:obj:`bool`, optional):
          Whether directly return the google cloud response.
          Defaults to `False`.
      return_only_text (:obj:`bool`, optional):
          Whether return only the texts in the OCR results.
          Defaults to `False`.
      agg_output_level (:obj:`~GCVFeatureType`, optional):
          When set, aggregate the GCV output with respect to the
          specified aggregation level. Defaults to `None`.
docstr_tok: ["Send","the","input","image","for","OCR",".","Args",":","image","(",":","obj",":","`","np.ndarray","`","or",":","obj",":","`","str","`",")",":","The","input","image","array","or","the","name","of","the","image","file","return_response","(",":","obj",":","`","bool","`",",","optional",")",":","Whether","directly","return","the","google","cloud","response",".","Defaults","to","`","False","`",".","return_only_text","(",":","obj",":","`","bool","`",",","optional",")",":","Whether","return","only","the","texts","in","the","OCR","results",".","Defaults","to","`","False","`",".","agg_output_level","(",":","obj",":","`","~GCVFeatureType","`",",","optional",")",":","When","set",",","aggregate","the","GCV","output","with","respect","to","the","specified","aggregation","level",".","Defaults","to","`","None","`","."]
code: def detect(
      self,
      image,
      return_response=False,
      return_only_text=False,
      agg_output_level=None,
  ):
      """Send the input image for OCR.
  
      Args:
          image (:obj:`np.ndarray` or :obj:`str`):
              The input image array or the name of the image file
          return_response (:obj:`bool`, optional):
              Whether directly return the google cloud response.
              Defaults to `False`.
          return_only_text (:obj:`bool`, optional):
              Whether return only the texts in the OCR results.
              Defaults to `False`.
          agg_output_level (:obj:`~GCVFeatureType`, optional):
              When set, aggregate the GCV output with respect to the
              specified aggregation level. Defaults to `None`.
      """
      if isinstance(image, np.ndarray):
          img_content = imencode(self.ocr_image_decode_type, image)[
              1
          ].tostring()
  
      elif isinstance(image, str):
          with io.open(image, "rb") as image_file:
              img_content = image_file.read()
  
      res = self._detect(img_content)
  
      if return_response:
          return res
  
      if return_only_text:
          return res.full_text_annotation.text
  
      if agg_output_level is not None:
          return self.gather_full_text_annotation(res, agg_output_level)
  
      return self.gather_text_annotations(res)
  
imports: import io
  import os
  import json
  import warnings
  import numpy
  from cv2 import imencode
  from .base import BaseOCRAgent, BaseOCRElementType
  from ..elements import Layout, TextBlock, Quadrilateral, TextBlock
  from ..file_utils import is_gcv_available
label_desc: Use image node_id 4 for calling the GCVAgent obj's underlying member method code with example usage: obj.detect(image, return_response, return_only_text, agg_output_level) and returns: self, res, res, self