Thai TrOCR - ONNX Quantized (INT8)
Quantized ONNX version of openthaigpt/thai-trocr.
Usage with Transformers.js
import { pipeline } from '@huggingface/transformers';
const ocr = await pipeline('image-to-text', 'StelleX/thai-trocr-onnx-quantized');
const result = await ocr('thai-text.png');
console.log(result[0].generated_text);
Usage with Python
from optimum.onnxruntime import ORTModelForVision2Seq
from transformers import TrOCRProcessor
from PIL import Image
processor = TrOCRProcessor.from_pretrained('StelleX/thai-trocr-onnx-quantized')
model = ORTModelForVision2Seq.from_pretrained('StelleX/thai-trocr-onnx-quantized')
image = Image.open('your_image.png').convert('RGB')
pixel_values = processor(images=image, return_tensors='pt').pixel_values
generated_ids = model.generate(pixel_values)
print(processor.batch_decode(generated_ids, skip_special_tokens=True)[0])
- Downloads last month
- 16
Model tree for StelleX/thai-trocr-lw
Base model
openthaigpt/thai-trocr