When utilizing tesseract.js on a URL, it functions correctly. However, when attempting to run it on a local file, I encounter errors. How can I troubleshoot this issue?
I am currently using tesseract.js v2.1.0 and below is the code snippet:
const { createWorker } = require('tesseract.js');
const worker = createWorker({
logger: m => console.log(m), // Include logger here
});
(async () => {
await worker.load();
await worker.loadLanguage('eng');
await worker.initialize('eng');
const { data: { text } } = await worker.recognize('download.png');
console.log(text);
await worker.terminate();
})();