code: def main(args):
      detection_model = detection.__dict__[args.detection](
          pretrained=True,
          bin_thresh=args.bin_thresh,
      )
      model = ocr_predictor(
          detection_model, args.recognition, pretrained=True
      )
      path = Path(args.path)
  
      os.makedirs(name="output", exist_ok=True)
  
      if path.is_dir():
          to_process = [
              f
              for f in path.iterdir()
              if str(f)
              .lower()
              .endswith(tuple(IMAGE_FILE_EXTENSIONS + OTHER_EXTENSIONS))
          ]
          for file_path in tqdm(to_process):
              _process_file(model, file_path, args.format)
      else:
          _process_file(model, path, args.format)
  
file_path: doctr/scripts/detect_text.py
imports: import argparse
  import json
  import os
  from pathlib import Path
  from tqdm import tqdm
  from doctr.file_utils import is_tf_available
  from doctr.io import DocumentFile
  from doctr.models import detection, ocr_predictor
label_desc: Use image node_id 2 for calling a global function with example usage: main(args) without return types