code: def test_trained_ocr_predictor(mock_payslip):
      doc = DocumentFile.from_images(mock_payslip)
  
      det_predictor = detection_predictor(
          "db_resnet50",
          pretrained=True,
          batch_size=2,
          assume_straight_pages=True,
          symmetric_pad=True,
          preserve_aspect_ratio=False,
      )
      reco_predictor = recognition_predictor(
          "crnn_vgg16_bn", pretrained=True, batch_size=128
      )
  
      predictor = OCRPredictor(
          det_predictor,
          reco_predictor,
          assume_straight_pages=True,
          straighten_pages=True,
          preserve_aspect_ratio=False,
      )
  
      out = predictor(doc)
  
      assert out.pages[0].blocks[0].lines[0].words[0].value == "Mr."
      geometry_mr = np.array(
          [[0.1083984375, 0.0634765625], [0.1494140625, 0.0859375]]
      )
      assert np.allclose(
          np.array(out.pages[0].blocks[0].lines[0].words[0].geometry),
          geometry_mr,
          rtol=0.05,
      )
  
      assert (
          out.pages[0].blocks[1].lines[0].words[-1].value == "revised"
      )
      geometry_revised = np.array(
          [[0.7548828125, 0.126953125], [0.8388671875, 0.1484375]]
      )
      assert np.allclose(
          np.array(out.pages[0].blocks[1].lines[0].words[-1].geometry),
          geometry_revised,
          rtol=0.05,
      )
  
      det_predictor = detection_predictor(
          "db_resnet50",
          pretrained=True,
          batch_size=2,
          assume_straight_pages=True,
          preserve_aspect_ratio=True,
          symmetric_pad=True,
      )
  
      predictor = OCRPredictor(
          det_predictor,
          reco_predictor,
          assume_straight_pages=True,
          straighten_pages=True,
          preserve_aspect_ratio=True,
          symmetric_pad=True,
      )
  
      out = predictor(doc)
  
      assert out.pages[0].blocks[0].lines[0].words[0].value == "Mr."
  
imports: import numpy
  import pytest
  from doctr import models
  from doctr.file_utils import CLASS_NAME
  from doctr.io import Document, DocumentFile
  from doctr.io.elements import KIEDocument
  from doctr.models import detection, recognition
  from doctr.models.detection.predictor import DetectionPredictor
  from doctr.models.detection.zoo import detection_predictor
  from doctr.models.kie_predictor import KIEPredictor
  from doctr.models.predictor import OCRPredictor
  from doctr.models.preprocessor import PreProcessor
  from doctr.models.recognition.predictor import RecognitionPredictor
  from doctr.models.recognition.zoo import recognition_predictor
  from doctr.utils.repr import NestedObject
label_desc: Use image node_id 2 for calling a global function with example usage: test_trained_ocr_predictor(mock_payslip) without return types