class_docstr: MMOCR Inferencer. It's a wrapper around three base task
  inferenecers: TextDetInferencer, TextRecInferencer and KIEInferencer,
  and it can be used to perform end-to-end OCR or KIE inference.
  
  Args:
      det (Optional[Union[ConfigType, str]]): Pretrained text detection
          algorithm. It's the path to the config file or the model name
          defined in metafile. Defaults to None.
      det_weights (Optional[str]): Path to the custom checkpoint file of
          the selected det model. If it is not specified and "det" is a model
          name of metafile, the weights will be loaded from metafile.
          Defaults to None.
      rec (Optional[Union[ConfigType, str]]): Pretrained text recognition
          algorithm. It's the path to the config file or the model name
          defined in metafile. Defaults to None.
      rec_weights (Optional[str]): Path to the custom checkpoint file of
          the selected rec model. If it is not specified and "rec" is a model
          name of metafile, the weights will be loaded from metafile.
          Defaults to None.
      kie (Optional[Union[ConfigType, str]]): Pretrained key information
          extraction algorithm. It's the path to the config file or the model
          name defined in metafile. Defaults to None.
      kie_weights (Optional[str]): Path to the custom checkpoint file of
          the selected kie model. If it is not specified and "kie" is a model
          name of metafile, the weights will be loaded from metafile.
          Defaults to None.
      device (Optional[str]): Device to run inference. If None, the available
          device will be automatically used. Defaults to None.
docstr: Pack text detection and recognition results into a list of
  TextSpottingDataSample.
docstr_tok: ["Pack","text","detection","and","recognition","results","into","a","list","of","TextSpottingDataSample","."]
code: def _pack_e2e_datasamples(
      self, preds: Dict
  ) -> List[TextSpottingDataSample]:
      """Pack text detection and recognition results into a list of
      TextSpottingDataSample."""
      results = []
  
      for det_data_sample, rec_data_samples in zip(
          preds["det"], preds["rec"]
      ):
          texts = []
          for rec_data_sample in rec_data_samples:
              texts.append(rec_data_sample.pred_text.item)
          det_data_sample.pred_instances.texts = texts
          results.append(det_data_sample)
      return results
  
imports: import os.path
  from datetime import datetime
  from typing import Dict, List, Optional, Tuple, Union
  import mmcv
  import mmengine
  import numpy
  from rich.progress import track
  from mmocr.registry import VISUALIZERS
  from mmocr.structures import TextSpottingDataSample
  from mmocr.utils import ConfigType, bbox2poly, crop_img, poly2bbox
  from .base_mmocr_inferencer import BaseMMOCRInferencer, InputsType, PredType, ResType
  from .kie_inferencer import KIEInferencer
  from .textdet_inferencer import TextDetInferencer
  from .textrec_inferencer import TextRecInferencer
label_desc: Use image node_id 7 for calling the MMOCRInferencer obj's underlying member method code with example usage: obj._pack_e2e_datasamples(preds) and returns: results