CoolFace
Apppublic

opendatalab/MinerU

sourceHugging Faceapache-2.0updated 1d agoView on Hugging Face
678likes
App README

Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference

Paper: https://huggingface.co/papers/2409.18839

ZeroGPU runtime

app.py launches the code in mineru_space/. Flash TXT and native Office/HTML/OFD inputs run in a CPU/PDFium sidecar; Flash OCR and all Basic PDF requests use ZeroGPU. The maximum is Basic, with 20 pages and a 60-second GPU parse watchdog. Cancellation waits for native work to finish before releasing the request slot.

The Space image supplies Python 3.12. The launcher reuses that interpreter to create an isolated environment, installs MinerU's exact dev HEAD, verifies it, and activates it only after success. Failed updates keep an existing compatible runtime; no usable runtime means startup fails clearly. The cache defaults to ~/.cache/mineru-space-runtime (MINERU_RUNTIME_CACHE overrides it), outside the checkout, and follows the Space's storage lifetime. Current and previous runtime manifests are retained for rollback.

The root requirements.txt installs launcher dependencies. The Space-specific pins for spaces, gradio, and torch are in mineru_space/runtime-requirements.txt. Other dependencies, including CPU onnxruntime, are resolved from MinerU's package metadata. Table inference is fixed to CPU and inherits MinerU's default 4/1 intra/inter-op threads. The Space does not set MINERU_INTRA_OP_NUM_THREADS or MINERU_INTER_OP_NUM_THREADS; explicit deployment overrides still work. Torch models still use CUDA and preload through ZeroGPU's emulation at startup. PDFium and ONNX sessions are not initialized in that parent process.

MINERU_PROFILE_STAGES=1 enables stage timings. Dispatch-to-entry time includes GPU scheduling and worker preparation. GPU-worker PDF rendering is serial; its deadline is the whole-request watchdog, not a separate render timeout.