Downloads · 30 days
30
3% of all-time downloads
suchut/thaitrocr-base-handwritten-beta2
thaitrocr-base-handwritten-beta2 is a image-to-text model from suchut. Use it when you need a caption or text from an image. It is set up for transformers. The card lists the license as apache-2.0.
The final version of the Thai-TrOCR model is out! Check it out here: huggingface.com/openthaigpt/thai-trocr
Downloads · 30 days
30
3% of all-time downloads
All-time downloads
1.1K
Public
Parameters
103M
412 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors411 MB · 99%
From the Hugging Face model README
The final version of the Thai-TrOCR model is out! Check it out here: huggingface.com/openthaigpt/thai-trocr
Thai-TrOCR is an advanced Optical Character Recognition (OCR) model fine-tuned specifically for recognizing handwritten text in Thai and English. Built on the robust TrOCR architecture, this model combines a Vision Transformer encoder with an Electra-based text decoder, allowing it to effectively handle multilingual text-line images.
Designed for efficiency and accuracy, Thai-TrOCR is lightweight, making it ideal for deployment in resource-constrained environments without compromising on performance.
Thai-TrOCR was trained using the following datasets:
pythainlp/thai-wiki-dataset-v3pythainlp/thaigov-corpusSalesforce/wikitextHere’s a quick guide to get started with the Thai-TrOCR model in PyTorch:
from transformers import TrOCRProcessor, VisionEncoderDecoderModel
from PIL import Image
import requests
# Load processor and model
processor = TrOCRProcessor.from_pretrained('suchut/thaitrocr-base-handwritten-beta2')
model = VisionEncoderDecoderModel.from_pretrained('suchut/thaitrocr-base-handwritten-beta2')
# Load an image
url = 'your_image_url_here'
image = Image.open(requests.get(url, stream=True).raw).convert("RGB")
# Process and generate text
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]
print(generated_text)