gpt4 book ai didi

javascript - 未捕获( promise )RuntimeError : function signature mismatch when using Tesseract. js

转载 作者:行者123 更新时间:2023-12-03 14:53:49 24 4
gpt4 key购买 nike

遇到了我怀疑是异步功能的问题。抛出的错误是: Uncaught (in promise) RuntimeError: function signature mismatch
当我尝试使用 tesseract.js 让我的图像通过 OCR 运行时
关于我做错了什么的任何想法?这是我构建异步函数的方式吗?

这是相关的片段。这表明最后一行导致错误

const { createWorker } = require('tesseract.js');

const worker = createWorker();
generateText = () => {
let uploads = this.state.uploads;
console.log(uploads);

for(var i = 0; i < uploads.length; i++) {


(async () => {
await worker.load();
await worker.loadLanguage('eng');
await worker.initialize('eng');
const { data: { text } } = await worker.recognize(uploads[i]);
console.log(text);
await worker.terminate();
})();
}
}

最佳答案

更新库,2.1.1版本出现该错误,2.1.2版本不再出现
https://cdnjs.com/libraries/tesseract.js/2.1.2

关于javascript - 未捕获( promise )RuntimeError : function signature mismatch when using Tesseract. js,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61276465/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com