Have run into what I suspect is a problem with the async function. The error thrown is: Uncaught (in promise) RuntimeError: function signature mismatch when I'm trying to have my image run through OCR using tesseract.js Any ideas on what I'm doing wrong? Is it the way I've constructed my async function?
This is the relevant snippet. It's indicating that the last line is causing the error
const { createWorker } = require('tesseract.js');
const worker = createWorker();
generateText = () => {
let uploads = this.state.uploads;
console.log(uploads);
for(var i = 0; i < uploads.length; i++) {
(async () => {
await worker.load();
await worker.loadLanguage('eng');
await worker.initialize('eng');
const { data: { text } } = await worker.recognize(uploads[i]);
console.log(text);
await worker.terminate();
})();
}
}
Update the library, that error occurs in version 2.1.1 and version 2.1.2 no longer comes out
https://cdnjs.com/libraries/tesseract.js/2.1.2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With