yukiapple323
commited on
Commit
•
4308790
1
Parent(s):
44b75d5
Update tesseract.js
Browse files- tesseract.js +19 -1
tesseract.js
CHANGED
@@ -1 +1,19 @@
|
|
1 |
-
npm install tesseract.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
npm install tesseract.js
|
2 |
+
|
3 |
+
// imgToText.js
|
4 |
+
|
5 |
+
import { createWorker } from 'tesseract.js';
|
6 |
+
|
7 |
+
const worker = await createWorker({
|
8 |
+
logger: (m) => console.log(m),
|
9 |
+
});
|
10 |
+
|
11 |
+
(async () => {
|
12 |
+
await worker.loadLanguage('eng');
|
13 |
+
await worker.initialize('eng');
|
14 |
+
const {
|
15 |
+
data: { text },
|
16 |
+
} = await worker.recognize('https://tesseract.projectnaptha.com/img/eng_bw.png');
|
17 |
+
console.log(text);
|
18 |
+
await worker.terminate();
|
19 |
+
})();
|