TrOCR-Sinhala
See training metrics tab for performance details.
Model description
This model is finetuned version of Microsoft TrOCR Printed
Intended uses & limitations
More information needed
Training and evaluation data
More information needed
Example
from PIL import Image
import requests
from io import BytesIO
from transformers import TrOCRProcessor, VisionEncoderDecoderModel, AutoTokenizer
image_url = "https://datasets-server.huggingface.co/assets/Ransaka/sinhala_synthetic_ocr/--/bf7c8a455b564cd73fe035031e19a5f39babb73b/--/default/train/0/image/image.jpg"
response = requests.get(image_url)
img = Image.open(BytesIO(response.content))
processor = TrOCRProcessor.from_pretrained('Ransaka/TrOCR-Sinhala')
model = VisionEncoderDecoderModel.from_pretrained('Ransaka/TrOCR-Sinhala')
model.to("cuda:0")
pixel_values = processor(img, return_tensors="pt").pixel_values.to('cuda:0')
generated_ids = model.generate(pixel_values,num_beams=2,early_stopping=True)
generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
generated_text #දිවයිනට බලයට ඇති ආපදා තත්ත්වය හමුවේ සබරගමුව පළාතේ
Framework versions
- Transformers 4.35.2
- Pytorch 2.0.0
- Datasets 2.16.0
- Tokenizers 0.15.0
- Downloads last month
- 34
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social
visibility and check back later, or deploy to Inference Endpoints (dedicated)
instead.
Model tree for Ransaka/TrOCR-Sinhala
Base model
Ransaka/sinhala-ocr-model