basic.html 582 Bytes
<html>
  <head>
    <script src="/dist/tesseract.dev.js"></script>
  </head>
  <body>
    <input type="file" id="uploader">
    <script>
      const recognize = async ({ target: { files }  }) => {
        const { data: { text } } = await Tesseract.recognize(files[0], 'eng', {
          corePath: '../../node_modules/tesseract.js-core/tesseract-core.wasm.js',
          logger: m => console.log(m),
        });
        console.log(text);
      }
      const elm = document.getElementById('uploader');
      elm.addEventListener('change', recognize);
    </script>
  </body>
</html>