Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tesseract.recognize promise never resolves on mobile #510

Closed
KaKi87 opened this issue Dec 31, 2020 · 7 comments
Closed

Tesseract.recognize promise never resolves on mobile #510

KaKi87 opened this issue Dec 31, 2020 · 7 comments

Comments

@KaKi87
Copy link

KaKi87 commented Dec 31, 2020

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

@fr3shn3ss
Copy link

I had the same issue. Downgraded to v2.1.1 and the issue is fixed
npm install tesseract.js@2.1.1

@KaKi87
Copy link
Author

KaKi87 commented Jan 17, 2021

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

@fr3shn3ss
Copy link

fr3shn3ss commented Jan 17, 2021 via email

@peterbe
Copy link

peterbe commented Aug 2, 2021

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.

@chocomeowy
Copy link

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.

@Balearica
Copy link
Collaborator

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
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants