Engine abstraction layer: pluggable OCR/HTR engines behind a registry

Hi,

we have been working on an engine-abstraction layer for eScriptorium at LMU Munich and would like to know whether you would welcome it upstream before opening a large merge request. It required touching many files, but most of it are new tests, docs and a bit of abstraction to allow different engines. Previous functionality is not impeded in any way and the host can decide whether to allow engines other then kraken. At relatively low cost, this would allow integration of newest models for specialized tasks.

Just wanted to feel out if this is something you would consider or if you think this is out of scope indefinitely.

What it does. Engines register through an entry-point group (escriptorium.engines) and declare what they can do — segment, recognise, train — plus their model sources, file extensions and preferred queue. Kraken moves behind an adapter; core no longer imports it directly. Adding an engine requires no change to eScriptorium: installing a package is the whole integration. Two engines exist as proof of concept in separate packages — Tesseract and TrOCR — and serve as the proof that the seam holds. I also have a prototype for using openai api compatible models, but its not part of the current fork. I have run the setup on internal server successfully.

For hosters who do not want this. The ESCRIPTORIUM_ENGINES setting is an allow-list; with it, a deployment offers only the engines it wants. An engine that fails to import is logged and skipped rather than taking the site down.

On not breaking kraken. In internal testing, a parity harness runs the same page through the pre- and post-refactor paths and requires identical text and near-identical geometry and confidences — currently 85/85 lines.

The branch is rebased onto current develop: https://gitlab.com/adibender-gitlab/escriptorium/-/tree/feature/engine-layer-upstream?ref_type=heads