We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
感谢作者在 PaddleOCR 的 js 部署方面做的工作,我尝试使用 esearch-OCR 在浏览器环境部署,但是遇到了一些问题,不知道应该如何解决。
esearch-OCR
主要操作:
import * as ocr from "esearch-ocr";
async function start() { const res = await axios.get("/ocr_keys_v1.txt"); console.log(res); await ocr.init({ detPath: "ocr_det.onnx", recPath: "ocr_rec.onnx", dic: res.data, node: false, }); let img = document.getElementById("ocr-image"); let canvas = document.createElement("canvas"); canvas.width = img.width; canvas.height = img.height; canvas.getContext("2d").drawImage(img, 0, 0); const result = await ocr.ocr( canvas.getContext("2d").getImageData(0, 0, img.width, img.height) ); setResult(result.reduce((total, cur) => total + `${cur.text}\n`)); }
本地 pnpm dev 没有问题,一旦build之后就会报错 Uncaught ReferenceError: require is not defined
pnpm dev
Uncaught ReferenceError: require is not defined
The text was updated successfully, but these errors were encountered:
这似乎是onnxruntime在vite下的部署问题 需要手动引入onnxruntime https://unpkg.com/[email protected]/dist/ort.min.js 然后在init函数制定ort:window['ort']
init
ort:window['ort']
Sorry, something went wrong.
No branches or pull requests
感谢作者在 PaddleOCR 的 js 部署方面做的工作,我尝试使用
esearch-OCR
在浏览器环境部署,但是遇到了一些问题,不知道应该如何解决。主要操作:
本地
pnpm dev
没有问题,一旦build之后就会报错Uncaught ReferenceError: require is not defined
The text was updated successfully, but these errors were encountered: