seyominaoto's picture
Rebrand to Handwriting OCR (drop neuro framing)
cb7dcd5
|
Raw
History Blame Contribute Delete
1.43 kB
metadata
title: Handwriting OCR Backend
emoji: ✍️
colorFrom: blue
colorTo: indigo
sdk: docker
app_port: 7860
pinned: false

Handwriting OCR Backend

FastAPI backend that turns handwritten images into text using microsoft/trocr-base-handwritten. Multi-line pages are split into lines and recognized line-by-line.

Endpoints

Method Path Description
GET / Service info
GET /health Liveness check + device
POST /ocr Upload an image, get recognized text (JSON)
GET /docs Interactive Swagger UI (test uploads here)

POST /ocr

Send multipart/form-data with a file field containing an image.

{
  "text": "This is a handwritten\nexample\nWrite as good as you can.",
  "lines": ["This is a handwritten", "example", "Write as good as you can."],
  "line_count": 3,
  "model": "microsoft/trocr-base-handwritten",
  "device": "cpu",
  "latency_seconds": 3.8
}

Tip: clear handwriting and good lighting give the best results. The page is segmented into lines automatically, so multi-line notes work too.

Run locally with Docker

docker build -t handwriting-ocr-backend .
docker run -p 7860:7860 handwriting-ocr-backend
# then open http://localhost:7860/docs