tesseract.js
tesseract.js copied to clipboard
Stuck on "loading language traineddata"
Describe the bug I have a simple html with script tags as follows.
<script src='https://unpkg.com/[email protected]/dist/tesseract.min.js'></script>
<script>
window.onload = async () => {
const worker = Tesseract.createWorker({
logger: m => console.log(m)
});
await worker.load();
await worker.loadLanguage('eng');
await worker.initialize('eng');
const recData = await worker.recognize('https://tesseract.projectnaptha.com/img/eng_bw.png');
console.log('=====recData===', recData);
await worker.terminate();
}
</script>
When the page loads, i the following logs on the console, and nothing else happens. What am I doing wrong?

Environment
- OS: MacOS Catalina
- Browser [e.g. chrome version 80]
Most of the time it is a network issue.
You can try to use the offline version first and see if it works: https://github.com/jeromewu/tesseract.js-offline
adding cachemethod: 'none' in worker constructor solved this issue for me.
loading data and workers from CDN is really the worst design choice in this wrapper.
Closed as duplicate of #414. I will look into why the promise returned by loadLanguage never resolves, and post findings on that issue.