A handwriting-OCR web app prototype: upload an image of handwriting, and a TensorFlow.js model predicts the characters — all client-side, no server. Sibling of NeuroOCR (which pairs Tesseract.js with TF.js).
Two known issues, stated plainly so nobody wastes an afternoon:
-
The model file is a Git LFS pointer.
public/models/handwriting_model.h5in this repo is a 134-byte LFS pointer, not the actual weights. Cloning withoutgit lfs pullgets you a stub. -
TensorFlow.js cannot load raw
.h5files.src/services/modelService.tscallstf.loadLayersModel('/models/handwriting_model.h5'), butloadLayersModelexpects the TF.js web format (model.json+ binary weight shards). A Keras.h5must first be converted with the tensorflowjs converter:pip install tensorflowjs tensorflowjs_converter --input_format keras \ handwriting_model.h5 public/models/handwriting_model/
…and the load path updated to
/models/handwriting_model/model.json.
Until both are fixed, the UI runs but processImage throws at model-load time.
- UI — React 18 + Vite + TypeScript + Tailwind single-page app (
src/App.tsx,src/components/ImageProcessor.tsx): select an image, trigger processing, display the result. - Pipeline code (
src/services/modelService.ts) — singleton service that preprocesses the upload (resize to 224×224, normalize to [0,1], batch dim), runsmodel.predict, and argmax-decodes the output against the character setA–Z a–z 0–9.
git clone https://github.com/bharat3645/NeuroOCR1.git
cd NeuroOCR1
git lfs pull # fetch the real .h5 (requires git-lfs)
npm install
npm run devThen convert the model as described above to make prediction actually work.
public/models/handwriting_model.h5 # Git LFS pointer (see status note)
src/
├── components/ImageProcessor.tsx # upload + result UI
├── services/modelService.ts # TF.js load / preprocess / predict / decode
├── App.tsx
└── main.tsx
MIT — see LICENSE.