code: def load_predictor(
      det_arch: str,
      reco_arch: str,
      assume_straight_pages: bool,
      straighten_pages: bool,
      bin_thresh: float,
      device: tf.device,
  ) -> OCRPredictor:
      """Load a predictor from doctr.models
  
      Args:
      ----
          det_arch: detection architecture
          reco_arch: recognition architecture
          assume_straight_pages: whether to assume straight pages or not
          straighten_pages: whether to straighten rotated pages or not
          bin_thresh: binarization threshold for the segmentation map
          device: tf.device, the device to load the predictor on
  
      Returns:
      -------
          instance of OCRPredictor
      """
      with device:
          predictor = ocr_predictor(
              det_arch,
              reco_arch,
              pretrained=True,
              assume_straight_pages=assume_straight_pages,
              straighten_pages=straighten_pages,
              export_as_straight_boxes=straighten_pages,
              detect_orientation=not assume_straight_pages,
          )
          predictor.det_predictor.model.postprocessor.bin_thresh = (
              bin_thresh
          )
      return predictor
  
imports: import numpy
  import tensorflow
  from doctr.models import ocr_predictor
  from doctr.models.predictor import OCRPredictor
label_desc: Use image node_id 1 for calling a global function with example usage: load_predictor(det_arch, reco_arch, assume_straight_pages, straighten_pages, bin_thresh, device) and returns: predictor