code: def _predictor(
      arch: Any, pretrained: bool, **kwargs: Any
  ) -> RecognitionPredictor:
      if isinstance(arch, str):
          if arch not in ARCHS:
              raise ValueError(f"unknown architecture '{arch}'")
  
          _model = recognition.__dict__[arch](
              pretrained=pretrained,
              pretrained_backbone=kwargs.get(
                  "pretrained_backbone", True
              ),
          )
      else:
          if not isinstance(
              arch,
              (
                  recognition.CRNN,
                  recognition.SAR,
                  recognition.MASTER,
                  recognition.ViTSTR,
                  recognition.PARSeq,
              ),
          ):
              raise ValueError(f"unknown architecture: {type(arch)}")
          _model = arch
  
      kwargs.pop("pretrained_backbone", None)
  
      kwargs["mean"] = kwargs.get("mean", _model.cfg["mean"])
      kwargs["std"] = kwargs.get("std", _model.cfg["std"])
      kwargs["batch_size"] = kwargs.get("batch_size", 32)
      input_shape = (
          _model.cfg["input_shape"][:2]
          if is_tf_available()
          else _model.cfg["input_shape"][-2:]
      )
      predictor = RecognitionPredictor(
          PreProcessor(
              input_shape, preserve_aspect_ratio=True, **kwargs
          ),
          _model,
      )
  
      return predictor
  
imports: from typing import Any, List
  from doctr.file_utils import is_tf_available
  from doctr.models.preprocessor import PreProcessor
  from ..None import recognition
  from .predictor import RecognitionPredictor
label_desc: Use image node_id 1 for calling a global function with example usage: _predictor(arch, pretrained) and returns: predictor