-
Notifications
You must be signed in to change notification settings - Fork 74
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
Unexpected Token #554
Comments
Can you provide a reproducible repository? An issue like this is usually related to how your bundle or transpiler is set up. You're loading ESM code but whatever setup is complaining that it doesn't know how to handle it. |
Closing for now, feel free to reopen with a reproducible repo |
Hello, reopening this issue with a reproducible repo https://github.com/hollowshiroyuki/Timi_OCR_Proto. I'm trying to increase TesseractJS results by upscaling before processing the picture. You need to uncomment lines 3, 6 and 17, and remove line 18 in Tested with :
Quick way to test : Thanks for your assistance ! |
@hollowshiroyuki I can’t access that repo - maybe it’s set to private? |
whoops sorry, it's fixed now 👍 |
Thanks, I can see it now. I’m on my phone and can check later, but at a glance - is this a Node.js project? If so you’ll need to import from node: Import ‘upscaler/node’ check out the getting started docs section on node. I’ll double check again when I’m front of my computer |
This is indeed a nodejs project and I'm using Typescript. I tried your suggestion but it didn't work, I'm not sure if it's a problem of the package or my typescript configuration. I also tried using https://www.typescriptlang.org/docs/handbook/module-resolution.html#path-mapping without success. {
"compilerOptions": {
"baseUrl": ".",
"paths": {
"upscaler": ["node_modules/upscaler/dist/node"],
}
}
} |
I opened https://github.com/hollowshiroyuki/Timi_OCR_Proto/pull/1/files which should resolve the issues you're seeing (I'm not familiar with TesseractJS, but the script completes without errors). Some things:
On the subject of needing to load the Node version with
Which has been roughly sufficient, as most Node projects can consume CJS (either because they're written in CJS themselves, or can use a transpiler) and most browser-based projects can consume either ESM (via a transpiler) or load the UMD script tag. It gets a bit trickier with the use of a tool like The reason I haven't provided an ESM-compatible Node version of the library so far is that Node also supports native ESM, but via the use of That said, this is good motivation to pick that investigation back up, as you probably are not the only one who will run into that issue (and it's weird to need a single |
Indeed it works now, we got better recognition performance, thanks a lot ! |
Awesome, great to hear! One other thing I should have mentioned, because you're in Node, you should experiment with providing an explicit model. I'd recommend either the 4x or 8x models from The reason I recommend this is because UpscalerJS is using the |
The text was updated successfully, but these errors were encountered: