Tesseract - Running in Browser Console #919
Replies: 1 comment
-
While I can't say that bundling Tesseract.js into a single file is impossible (somebody could probably figure it out with enough time), it is not possible with our current projects structure/build system, and I cannot imagine that making it work would be easier than finding alternative ways to accomplish whatever you're trying to do. Tesseract.js requires 4 files in total: the main thread scripts ( |
Beta Was this translation helpful? Give feedback.
-
Sorry, I know this is not an issue at all, so I apologise for posting here.
I am trying to use Tesseract within the browser console. This is for a site for which is not my own so I cannot embed external scripts for security reasons, hence why I run my code in the browser console. However, it is only for personal use and for intention of reading data from a canvas image.
I embedded the JS from 'https://cdn.jsdelivr.net/npm/tesseract.js@5.0.5/dist/tesseract.min.js' and then ran the following from the examples page of Tesseract GitHub pages:
(async () => {
const worker = await createWorker('eng');
const ret = await worker.recognize('https://tesseract.projectnaptha.com/img/eng_bw.png');
console.log(ret.data.text);
await worker.terminate();
})();
Which produces the following error (also because of security issues.): 'VM11097:6 Uncaught (in promise) Uncaught NetworkError: Failed to execute 'importScripts' on 'WorkerGlobalScope': The script at 'https://cdn.jsdelivr.net/npm/tesseract.js@v5.0.5/dist/worker.min.js' failed to load.'
Is it possible to compile the Tesseract JS files into a single block of code? Essentially, I want to bypass anything which involves referencing an external source.
Many thanks, greatly appreciated.
Beta Was this translation helpful? Give feedback.
All reactions