Downloads · 30 days
7
5% of all-time downloads
Gitesh2003/TrOCR
TrOCR is a machine learning model from Gitesh2003. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
This is a fine-tuned Microsoft TrOCR Large model for handwritten text recognition. It has been trained on a dataset containing scanned handwritten documents.
Downloads · 30 days
7
5% of all-time downloads
All-time downloads
140
Public
Repo size
6.7 GB
Likes
0
Public
Click a slice to open those files.
.bin2.2 GB · 100%
From the Hugging Face model README
This is a fine-tuned Microsoft TrOCR Large model for handwritten text recognition. It has been trained on a dataset containing scanned handwritten documents.
git-lfs for model filesYou can load and use the fine-tuned model with transformers in Python as follows:
from transformers import TrOCRProcessor, VisionEncoderDecoderModel
from PIL import Image
# Load model and processor
processor = TrOCRProcessor.from_pretrained("Gitesh2003/TrOCR")
model = VisionEncoderDecoderModel.from_pretrained("Gitesh2003/TrOCR")
# Load an image
image = Image.open("handwritten_sample.jpg").convert("RGB")
# Process and predict text
pixel_values = processor(images=image, return_tensors="pt").pixel_values
generated_ids = model.generate(pixel_values)
extracted_text = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
print("Extracted Text:", extracted_text)