Skip to content

bharat3645/neuro-ocr-v1

Repository files navigation

NeuroOCR1

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).

⚠️ Current status — model loading is non-functional

Two known issues, stated plainly so nobody wastes an afternoon:

  1. The model file is a Git LFS pointer. public/models/handwriting_model.h5 in this repo is a 134-byte LFS pointer, not the actual weights. Cloning without git lfs pull gets you a stub.

  2. TensorFlow.js cannot load raw .h5 files. src/services/modelService.ts calls tf.loadLayersModel('/models/handwriting_model.h5'), but loadLayersModel expects the TF.js web format (model.json + binary weight shards). A Keras .h5 must 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.

What works

  • 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), runs model.predict, and argmax-decodes the output against the character set A–Z a–z 0–9.

Getting started

git clone https://github.com/bharat3645/NeuroOCR1.git
cd NeuroOCR1
git lfs pull        # fetch the real .h5 (requires git-lfs)
npm install
npm run dev

Then convert the model as described above to make prediction actually work.

Project structure

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

License

MIT — see LICENSE.

About

Handwriting-OCR web app prototype - React 18 + Vite + TS with TensorFlow.js; upload an image, preprocess to 224x224, predict characters. Note: the bundled .h5 model is a Git-LFS pointer and tf.js needs a converted model.json, so model loading is currently non-functional.

Topics

Resources

License

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors