Pure Javascript OCR for more than 100 Languages 📖🎉🖥
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
661 B

5 years ago
const createWorker = require('./createWorker');
const recognize = async (image, langs, options) => {
const worker = createWorker(options);
await worker.load();
await worker.loadLanguage(langs);
await worker.initialize(langs);
return worker.recognize(image)
.finally(async () => {
await worker.terminate();
5 years ago
});
};
const detect = async (image, options) => {
const worker = createWorker(options);
await worker.load();
await worker.loadLanguage('osd');
await worker.initialize('osd');
return worker.detect(image)
.finally(async () => {
await worker.terminate();
5 years ago
});
};
module.exports = {
recognize,
detect,
};