Install and use Guten OCR in the Browser
mainTo use Guten OCR in a web browser, install @gutenye/ocr-browser. When calling Ocr.create(), you must provide a models configuration object specifying the paths to the required ONNX model files and the dictionary file.
bun add @gutenye/ocr-browser
import Ocr from '@gutenye/ocr-browser'
const ocr = await Ocr.create({
models: {
detectionPath: '/assets/ch_PP-OCRv4_det_infer.onnx',
recognitionPath: '/assets/ch_PP-OCRv4_rec_infer.onnx',
dictionaryPath: '/assets/ppocr_keys_v1.txt'
}
})
const result = await ocr.detect('/a.jpg')