HandwritingParser / README.md
Varun95's picture
Upload README.md
57a56c3 verified
|
Raw History Blame Contribute Delete
1.58 kB
---
title: ScriptFlow
emoji: ✍️
colorFrom: indigo
colorTo: purple
sdk: gradio
sdk_version: "4.36.0"
app_file: app.py
pinned: false
license: mit
---
# ScriptFlow — Handwriting PDF → Word Document
Upload a handwritten PDF and get a clean `.docx` file back.
## Pipeline
| Step | Tool | Notes |
|------|------|-------|
| PDF → images | `pdftoppm` (Poppler) | 200 DPI PNG per page |
| Images → text | TrOCR (small or base) | HuggingFace `microsoft/trocr-*-handwritten` |
| Text → refined | T5 grammar correction | Optional — `vennify/t5-base-grammar-correction` |
| Text → .docx | python-docx | Page breaks at each PDF page |
## Deployment (your own Space)
1. Create a new Space on [huggingface.co/spaces](https://huggingface.co/spaces) — choose **Gradio**, **CPU basic** (free).
2. Upload all files from this folder:
- `app.py`
- `requirements.txt`
- `packages.txt`
- `README.md`
3. The Space builds automatically — first build takes ~3 min (installs torch CPU + packages).
## Expected speed (CPU free tier)
| Page count | OCR only | OCR + grammar |
|-----------|----------|---------------|
| 1 page | ~30–60 s | ~90–120 s |
| 5 pages | ~3–5 min | ~7–10 min |
> Models are cached after the first run within the same session, so subsequent uploads are faster.
## Tips
- Use **small** TrOCR model for speed; switch to **base** for denser/messier handwriting.
- Disable grammar correction for a faster raw OCR result — you can always clean up the `.docx` manually.
- Scans at ≥ 200 DPI give significantly better OCR accuracy.