Downloads · 30 days
34
0% of all-time downloads
kkatiz/thai-trocr-thaigov-v2
thai-trocr-thaigov-v2 is a image-to-text model from kkatiz. Use it when you need a caption or text from an image. It is set up for transformers.
Vision Encoder Decoder Models - Use microsoft/trocr-base-handwritten as encoder. - Use airesearch/wangchanberta-base-att-spm-uncased as decoder - Fine-tune on 250k synthetic text images dataset using ThaiGov V2 Corpus…
Downloads · 30 days
34
0% of all-time downloads
All-time downloads
8.3K
Public
Parameters
220M
2.6 GB on disk
Likes
13
Public
Click a slice to open those files.
.safetensors881 MB · 100%
From the Hugging Face model README
Vision Encoder Decoder Models
from PIL import Image
from transformers import TrOCRProcessor, VisionEncoderDecoderModel
processor = TrOCRProcessor.from_pretrained("kkatiz/thai-trocr-thaigov-v2")
model = VisionEncoderDecoderModel.from_pretrained("kkatiz/thai-trocr-thaigov-v2")
image = Image.open("... your image path").convert("RGB")
pixel_values = processor(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)