yukiapple323's picture
Update tesseract.js
4308790 verified
raw
history blame contribute delete
416 Bytes
npm install tesseract.js
// imgToText.js
import { createWorker } from 'tesseract.js';
const worker = await createWorker({
logger: (m) => console.log(m),
});
(async () => {
await worker.loadLanguage('eng');
await worker.initialize('eng');
const {
data: { text },
} = await worker.recognize('https://tesseract.projectnaptha.com/img/eng_bw.png');
console.log(text);
await worker.terminate();
})();