tesseract.js
tesseract.js copied to clipboard
Tesseract.recognize promise never resolves on mobile
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:
- Call
Tesseract.recognizeon mobile - 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
I had the same issue. Downgraded to v2.1.1 and the issue is fixed npm install [email protected]
Downgrading to v2.1.1 didn't solved my issue, but thanks anyway.
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 .
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.
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.
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.
Closing given that this appears to have been resolved in an update (see above).