Downloads · 30 days
7
15% of all-time downloads
kun826/trocr_handwrite_option4
trocr_handwrite_option4 is a image-text-to-text model from kun826. Use it for the image-text-to-text task on the model card, and read the license before you ship it in a product. It is set up for transformers. The card lists the license as mit.
Downloads · 30 days
7
15% of all-time downloads
All-time downloads
47
Public
Parameters
61.6M
248 MB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors246 MB · 98%
From the Hugging Face model README
from transformers import TrOCRProcessor, VisionEncoderDecoderModel
from PIL import Image
import requests
# load image from the IAM database
url = 'https://fki.tic.heia-fr.ch/static/img/a01-122-02-00.jpg'
image = Image.open(requests.get(url, stream=True).raw).convert("RGB")
processor = TrOCRProcessor.from_pretrained('kun826/trocr_handwrite_option4')
model = VisionEncoderDecoderModel.from_pretrained('kun826/trocr_handwrite_option4')
pixel_values = processor(images=image, return_tensors="pt").pixel_values
generated_ids = model.generate(pixel_values)
generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]