next.js - Tesseract Worker.Load 挂在 Vercel 上
问题描述
不确定是否有人可以提供帮助,但我在我的 Next JS 应用程序中使用 Tesseract.js 在我的本地站点上有一个 OCR 阅读器。它在本地和读取 smy 图像上工作正常,但是当我部署到 Vercel 时它挂在这条线上......
await worker.load()
这是整个事情
const worker = createWorker()
console.log('createWorker')
//attempt ocr on processed image
await worker.load()
console.log('worker.load')
//set language to plain english
await worker.loadLanguage('eng')
await worker.initialize('eng')
//set character whitelist and disable dictionary functions that won't help us here
await worker.setParameters({
tessedit_char_whitelist:
'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-/$.@| ',
load_system_dawg: 0,
load_freq_dawg: 0,
})
console.log('setParameters')
//process editted image
const OcrResult = await worker.recognize(imageb64)
if (process.env.DEBUG >= 1) {
console.log('[DEBUG] OCR: Process complete, results: ', OcrResult.data.text)
}
关于 Vercel 的任何怪癖会使它无法在测试站点上运行吗?
谢谢
解决方案
您可以尝试使用类似这样的东西,旨在用于 lambda 函数。
推荐阅读
- aws-lambda - AWS codepipeline - 如何更新 lambda 的函数代码?
- google-cloud-platform - 如何将 GCP 服务帐户 key.json 内容传递到 Terraform Cloud 而不在 VCS 中提交?
- cython - cython 教程“使用 c 库”令人困惑
- clojure - Datomic:无法评估来自 REPL 的 d/transaction
- php - 部署到远程服务器时出现错误“需要数据库才能访问后端”
- php - 如何将产品类别添加到 Divi 主题的 woocommerce 产品循环中?
- openid - ADFS(作为 SP)是否支持与 OpenID IDP 集成
- symfony - 带有 symfony 4 的 VichUploaderBundle:没有扩展能够加载“映射”的配置
- java - 有时 IoException:Mark Invalid Jsoup Android App
- unity3d - 与分辨率相关的对象生成