Kamalan C S

Transformer handwriting recognition · 2025

InkSight

Write on a canvas and a vision transformer reads it: Microsoft TrOCR served from FastAPI behind an animated Next.js interface.

Open live demo (opens in a new tab)

Concept illustration for InkSight

The vision

Pen on screen, text out: transformer OCR wrapped in an interface that feels instant.

Problem

Classic CNN-based OCR struggles with varied handwriting styles and distortions.

Solution

A Next.js canvas captures strokes and sends the image to a FastAPI service running TrOCR, a Vision Transformer encoder with an autoregressive text decoder. The deployment write-up documents memory limits on free tiers and the path to GPU hosting.

Architecture

InkSight architectureCLIENTSEDGE & APISERVICESDATA & EXTERNALimageNext.js canvasFastAPI/predictTrOCR processorViT + decoderHugging Face
  • Next.js canvas to FastAPI (image)
  • FastAPI to TrOCR processor
  • TrOCR processor to ViT + decoder

Engineering highlights

  • TrOCR (ViT encoder + GPT-style decoder) inference without fine-tuning
  • Canvas input pipeline: stroke capture → image → model
  • FastAPI inference endpoint with interactive OpenAPI docs
  • Documented deployment constraints: transformer memory footprint vs. 512 MB tiers