fix ocr can't recognize chinese characters

This commit is contained in:
wuyingren 2020-03-16 16:20:24 +08:00
parent 9282803871
commit 116cebaea4
5 changed files with 9 additions and 5 deletions

View file

@ -224,11 +224,15 @@ class FocalPointModal extends ImmutablePureComponent {
}
}
worker.recognize(media_url)
.progress(({ progress }) => this.setState({ progress }))
.finally(() => worker.terminate())
.then(({ text }) => this.setState({ description: removeExtraLineBreaks(text), dirty: true, detecting: false }))
.catch(() => this.setState({ detecting: false }));
(async () => {
await worker.loadLanguage('eng+chi_sim+chi_sim_vert+chi_tra+chi_tra_vert');
await worker.initialize('eng+chi_sim+chi_tra');
worker.recognize(media_url)
.progress(({ progress }) => this.setState({ progress }))
.finally(() => worker.terminate())
.then(({ text }) => this.setState({ description: removeExtraLineBreaks(text), dirty: true, detecting: false }))
.catch(() => this.setState({ detecting: false }));
})();
}).catch(() => this.setState({ detecting: false }));
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.