Fix doc examples (#15257)

This commit is contained in:
NielsRogge
2022-01-20 21:51:51 +01:00
committed by GitHub
parent ad7390636d
commit 515ed3ad2a
2 changed files with 39 additions and 10 deletions

View File

@@ -70,7 +70,8 @@ into a single instance to both extract the input features and decode the predict
>>> processor = TrOCRProcessor.from_pretrained("microsoft/trocr-base-handwritten")
>>> model = VisionEncoderDecoderModel.from_pretrained("microsoft/trocr-base-handwritten")
>>> # load image from the IAM dataset url = "https://fki.tic.heia-fr.ch/static/img/a01-122-02.jpg"
>>> # load image from the IAM dataset
>>> url = "https://fki.tic.heia-fr.ch/static/img/a01-122-02.jpg"
>>> image = Image.open(requests.get(url, stream=True).raw).convert("RGB")
>>> pixel_values = processor(image, return_tensors="pt").pixel_values