tesseract.js icon indicating copy to clipboard operation
tesseract.js copied to clipboard

Tesseract.recognize promise never resolves on mobile

Open KaKi87 opened this issue 4 years ago • 6 comments

Describe the bug The promise returned by Tesseract.recognize always resolves on desktop but never does on mobile.

To Reproduce Steps to reproduce the behavior:

  1. Call Tesseract.recognize on mobile
  2. Wait for promise resolution indefinitely

Expected behavior The method promise resolves on mobile as it does on desktop.

Desktop (please complete the following information):

  • OS: [e.g. iOS] Windows 10
  • Browser [e.g. chrome, safari] Brave
  • Version [e.g. 22] 1.18.77

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6] Xiaomi Mi 8
  • OS: [e.g. iOS8.1] Android 10
  • Browser [e.g. stock browser, safari] Kiwi
  • Version [e.g. 22] Quadea 158-1

Additional context Running as userscript on Violentmonkey.


Thanks

KaKi87 avatar Dec 31 '20 03:12 KaKi87

I had the same issue. Downgraded to v2.1.1 and the issue is fixed npm install [email protected]

fr3shn3ss avatar Jan 17 '21 02:01 fr3shn3ss

Downgrading to v2.1.1 didn't solved my issue, but thanks anyway.

KaKi87 avatar Jan 17 '21 07:01 KaKi87

In my case, i did this: npm uninstall tesseract.js npm install [email protected] npm install

On Sun, Jan 17, 2021, 2:53 AM KaKi87 [email protected] wrote:

Downgrading to v2.1.1 didn't solved my issue, but thanks anyway.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/naptha/tesseract.js/issues/510#issuecomment-761750186, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHY4ZELDQPNXUOANBL7LVOTS2KJRFANCNFSM4VO7XFTQ .

fr3shn3ss avatar Jan 17 '21 11:01 fr3shn3ss

Me too. I have this code:

async function getText(imageFile: File) {
  Tesseract.recognize(imageFile, "eng", {
    logger: (m) => {
      if (m.progress) {
        setProgress(100 * m.progress);
      }
      // console.log(m);
    },
  })
    .catch((err) => {
      console.error(err);
      setTesseractError(err);
    })
    .then((result) => {
      if (result) {
        const { data } = result;
        setPageData(data);
      } else {
        setPageData(false);
      }
    });
}

in Firefox, Chrome, and desktop Safari it works great. But on Safari iOS it always crashes. I've tried with 2.1.4 and 2.1.3, and, I think, 2.1.1.

Not sure if it matters, but the input image is a .jpeg and I put its src into and <img> first so I know that I can render and see the actual image in my iOS Safari web app.

peterbe avatar Aug 02 '21 11:08 peterbe

Encountered similar issue but it only crash on mobile safari. Follow fr3shn3ss and downgraded to 2.1.1 and it worked. Will try other versions.

chocomeowy avatar Jun 25 '22 14:06 chocomeowy

If this issue is still active, please confirm whether this is an issue with the latest version (v3). The problematic 2.1.2 update that appears to be the issue (given discussion above) was removed, so if downgrading to 2.1.1 resolved then I believe the problem should be solved in the latest version.

Balearica avatar Sep 18 '22 05:09 Balearica

Closing given that this appears to have been resolved in an update (see above).

Balearica avatar Nov 25 '22 20:11 Balearica