flow_inference.create_trocr_dataset.TrOCRInferenceDataset

class flow_inference.create_trocr_dataset.TrOCRInferenceDataset(records, image_handler)[source]

Represent Hugging Face records as a PyTorch dataset for TrOCR inference.

The dataset receives in-memory records, processes each record’s image through an ImageHandler, and returns pixel tensors together with line-level metadata required to map predictions back to their source document.

Parameters:
__init__(records, image_handler)[source]

Initialize the inference dataset.

Parameters:
  • records (List[Dict]) – Hugging Face-style records containing image data and metadata.

  • image_handler (ImageHandler) – Image handler used to normalize and process record images.

Methods

__init__(records, image_handler)

Initialize the inference dataset.