johnlockejrr/regnetx-8gf-polyline-baseline-stage0
RegNetX Polyline Baselines — Stage-0 demo
Gradio Space (ZeroGPU / CUDA, CPU fallback) for `johnlockejrr/regnetx-8gf-polyline-baseline-stage0`.
Upload a historical manuscript page → detect text-line baselines (polylines) → inspect an overlay with optional BLLA polygonal environments. Layer toggles (baselines / polygons / scores) re-draw without re-running the model.
This is the multiscript Stage-0 foundation checkpoint, not the Hebrew/Samaritan domain fine-tune. For the specialized Hebrew + Samaritan release, see `johnlockejrr/regnetx-8gf-polyline-hebrew-samaritan`.
What is included
This folder is an inference-only package (regnetx_infer/). It does not contain training loops, Lightning modules, Arrow compilers, matchers, losses, or experiment CLIs.
Local run
cd gradio
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
# optional local weights to skip Hub download:
# export REGNETX_WEIGHTS=/path/to/PRETRAIN/regnetx_stage0/best_cbad_f1.safetensors
python app.pyOverride Hub repo without editing code:
export REGNETX_REPO=johnlockejrr/regnetx-8gf-polyline-baseline-stage0
python app.pySpace tips
- Set Space hardware to ZeroGPU (Settings → Hardware).
- Upload the Stage-0 model repo first (public
best_cbad_f1.safetensors). - Canvas is fixed at 1280×1280 (training resolution).
- Detection runs under
@spaces.GPU(falls back to CPU locally). - Disable polygonize for a faster baselines-only pass.
- Default confidence 0.40 (Stage-0 val
cbad_f1_max); 0.50 is a close alternative. Do not use 0.1. - Default reading order ltr — switch to rtl for Hebrew/Samaritan pages or ttb for vertical scripts.
- Override device with
REGNETX_DEVICE=cpuorcudaif needed.
Dependencies
Stay on ZeroGPU hardware. Set Gradio only via README sdk_version: 6.1.0 (do not also pin gradio==… in requirements.txt — Spaces installs gradio[oauth,mcp]==<sdk_version> and pip will conflict).
Model weights load on CPU in process memory at startup; CUDA runs only inside @spaces.GPU on Detect — that is still ZeroGPU, not a CPU Space.
app.py injects a small fetch patch so if HF reports APP_STARTING while the app is already up, the browser treats it as RUNNING and mounts the UI.
After changing sdk_version / requirements.txt, do a Factory reboot.
D-FINE HybridEncoder: https://arxiv.org/abs/2410.13842 Weights: https://huggingface.co/johnlockejrr/regnetx-8gf-polyline-baseline-stage0
