Implement OCR

master
Chloe Fontenot 🏳️‍⚧️ 2024-08-09 23:03:37 +07:00
parent 90f3bbb037
commit 0667dd70d8
1 changed files with 1 additions and 1 deletions

@ -209,7 +209,7 @@ function getMatchingPhrase(inputString, targetCharacter) {
(async () => { (async () => {
// Does the message have an attachment? Check the attachment with OCR // Does the message have an attachment? Check the attachment with OCR
console.log(message.attachments); console.log(message.attachments);
if (message.attachments.contentType.contains("image")) { if (message.attachments.contentType.includes("image")) {
const worker = await createWorker('eng'); const worker = await createWorker('eng');
const ret = await worker.recognize(message.attachments.proxyURL); const ret = await worker.recognize(message.attachments.proxyURL);
console.log("OCR Results: " + ret.data.text); console.log("OCR Results: " + ret.data.text);