code: def parse_args(mMain=True):
      import argparse
  
      parser = init_args()
      parser.add_help = mMain
      parser.add_argument("--lang", type=str, default="ch")
      parser.add_argument("--det", type=str2bool, default=True)
      parser.add_argument("--rec", type=str2bool, default=True)
      parser.add_argument("--type", type=str, default="ocr")
      parser.add_argument(
          "--ocr_version",
          type=str,
          choices=SUPPORT_OCR_MODEL_VERSION,
          default="PP-OCRv4",
          help="OCR Model version, the current model support list is as follows: "
          "1. PP-OCRv4/v3 Support Chinese and English detection and recognition model, and direction classifier model"
          "2. PP-OCRv2 Support Chinese detection and recognition model. "
          "3. PP-OCR support Chinese detection, recognition and direction classifier and multilingual recognition model.",
      )
      parser.add_argument(
          "--structure_version",
          type=str,
          choices=SUPPORT_STRUCTURE_MODEL_VERSION,
          default="PP-StructureV2",
          help="Model version, the current model support list is as follows:"
          " 1. PP-Structure Support en table structure model."
          " 2. PP-StructureV2 Support ch and en table structure model.",
      )
  
      for action in parser._actions:
          if action.dest in [
              "rec_char_dict_path",
              "table_char_dict_path",
              "layout_dict_path",
          ]:
              action.default = None
      if mMain:
          return parser.parse_args()
      else:
          inference_args_dict = {}
          for action in parser._actions:
              inference_args_dict[action.dest] = action.default
          return argparse.Namespace(**inference_args_dict)
  
imports: import os
  import sys
  import importlib
  import paddle
  import cv2
  import logging
  import numpy
  from pathlib import Path
  import base64
  from io import BytesIO
  from PIL import Image
  from ppocr.utils.logging import get_logger
  from tools.infer import predict_system
  from ppocr.utils.utility import check_and_read, get_image_file_list, alpha_to_color, binarize_img
  from ppocr.utils.network import maybe_download, download_with_progressbar, is_link, confirm_model_dir_url
  from tools.infer.utility import draw_ocr, str2bool, check_gpu
  from ppstructure.utility import init_args, draw_structure_result
  from ppstructure.predict_system import StructureSystem, save_structure_res, to_excel
label_desc: Use image node_id 2 for calling a global function with example usage: parse_args(mMain) and returns: parser, argparse