Running tesseract.js on retool?

Hi everyone! I'm fairly new to Javascript but am actively spending time learning. I'm trying to use tesseract.js library for OCR but am unable to get the following sample code running.

The code sample works in Visual Studio Code, where I also include import Tesseract from 'tesseract.js'; as a command whereas in retool I use the following CDN: https://unpkg.com/tesseract.js@v2.1.0/dist/tesseract.min.js

Any help would be greatly appreciated!

Code:

console.log('here-1')
Tesseract
  .recognize('https://tesseract.projectnaptha.com/img/eng_bw.png', 'eng', { logger: m => console.log(m) })
  .then(({ data: { text } }) => { console.log(text) })
console.log('here-2')

Hey ajhanwar, I tested this out on my end adding an await before Tessaract.recognize and this ran for a large number of minutes before I stopped the function. I'm afraid that Tessaract isn't a great fit for Retool due to the limitations of our sandbox :slightly_frowning_face:

I wish I had better news for you!

2 Likes