forked from jeromewu/tesseract.js-electron
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.html
26 lines (24 loc) · 801 Bytes
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
<!-- https://electronjs.org/docs/tutorial/security#csp-meta-tag -->
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
<script src="./node_modules/tesseract.js/dist/tesseract.min.js"></script>
</head>
<body>
<script type="module">
const worker = await Tesseract.createWorker("eng", 1, {
workerPath: "./node_modules/tesseract.js/dist/worker.min.js",
logger: m => console.log(m),
workerBlobURL: false
});
(async () => {
const { data: { text } } = await worker.recognize("./images/testocr.png");
console.log(text);
await worker.terminate();
})();
</script>
</body>
</html>