TrOCR is always used within the VisionEncoderDecoder framework.
Inference
TrOCR's [VisionEncoderDecoder] model accepts images as input and makes use of
[~generation_utils.GenerationMixin.generate] to autoregressively generate text given the input image.
The [ViTFeatureExtractor/DeiTFeatureExtractor] class is responsible for preprocessing the input image and
[RobertaTokenizer/XLMRobertaTokenizer] decodes the generated target tokens to the target string. The
[TrOCRProcessor] wraps [ViTFeatureExtractor/DeiTFeatureExtractor] and [RobertaTokenizer/XLMRobertaTokenizer]
into a single instance to both extract the input features and decode the predicted token ids.
Step-by-step Optical Character Recognition (OCR)
``` py
from transformers import TrOCRProcessor, VisionEncoderDecoderModel
import requests 
