chnaged logic in ocr
This commit is contained in:
@@ -781,11 +781,15 @@ function cameraCapture() {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
async initWorker() {
|
async initWorker() {
|
||||||
if (this.ocrWorker) return;
|
if (this.ocrWorker) return;
|
||||||
|
|
||||||
// ✅ Create and load OCR worker once
|
console.log("⏳ Loading OCR worker...");
|
||||||
this.ocrWorker = await Tesseract.createWorker('eng');
|
|
||||||
|
this.ocrWorker = await Tesseract.createWorker({
|
||||||
|
logger: info => console.log(info.status, info.progress)
|
||||||
|
});
|
||||||
|
|
||||||
await this.ocrWorker.loadLanguage('eng');
|
await this.ocrWorker.loadLanguage('eng');
|
||||||
await this.ocrWorker.initialize('eng');
|
await this.ocrWorker.initialize('eng');
|
||||||
this.isWorkerReady = true;
|
this.isWorkerReady = true;
|
||||||
@@ -793,6 +797,7 @@ function cameraCapture() {
|
|||||||
console.log("✅ OCR Worker Ready");
|
console.log("✅ OCR Worker Ready");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
async switchCamera() {
|
async switchCamera() {
|
||||||
this.currentFacingMode = this.currentFacingMode === 'user' ? 'environment' : 'user';
|
this.currentFacingMode = this.currentFacingMode === 'user' ? 'environment' : 'user';
|
||||||
await this.initCamera();
|
await this.initCamera();
|
||||||
|
|||||||
Reference in New Issue
Block a user