I have this error whenever I try to terminate the Tesseract worker in VueJS.
The problem starts when I re-uploaded another image to the app, I need to Crtl+Shift+R to temporarily solve it.
This is my Vue
<script>
import worker from "@/plugin/tesseract";
export default {
methods: {
async recognize() {
this.$helpers.loading();
try {
const result = await worker.recognize(image);
console.log(result)
await worker.terminate();
this.$helpers.close();
} catch (err) {
await worker.terminate();
this.$helpers.showError(err);
}
},
}
}
</script>
This is my tesseract.js
import {createWorker} from "tesseract.js";
const worker = createWorker({
// workerPath: 'https://unpkg.com/[email protected]/dist/worker.min.js',
langPath:
"https://raw.githubusercontent.com/naptha/tessdata/gh-pages/4.0.0_best/",
// corePath: 'https://unpkg.com/[email protected]/tesseract-core.wasm.js',
logger: (m) => console.log(m)
});
(async () => {
await worker.load();
await worker.loadLanguage("vie");
await worker.initialize("vie");
})();
export default worker;
Please help.