mirror of
https://github.com/yingziwu/mastodon.git
synced 2026-02-06 12:35:14 +00:00
fix ocr can't recognize chinese characters
This commit is contained in:
parent
9282803871
commit
116cebaea4
5 changed files with 9 additions and 5 deletions
|
|
@ -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 }));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue