PaDoc / README.md
TonyZhan's picture
Rename Space to PaDoc
526e9ad verified
|
Raw
History Blame Contribute Delete
1.74 kB
metadata
title: PaDoc
emoji: 📄
colorFrom: green
colorTo: gray
sdk: gradio
sdk_version: 6.22.0
app_file: app.py
python_version: '3.12'
startup_duration_timeout: 1h
short_description: Stream parallel document parsing with PaDoc
models:
  - Longin-Yu/PaDoc

PaDoc

This Space runs the Transformers parallel decoding path from PaDoc on ZeroGPU. It exposes only lockstep-batched parallel execution: the main layout stream and every active content branch advance together, bounded by eight concurrent branches.

The Gradio handler streams scheduler state, main tokens, branch content, detected layout boxes, and the final JSON result as generation runs. It is the ZeroGPU-compatible equivalent of:

CUDA_VISIBLE_DEVICES=0 padoc-transformers-serve \
  --model Longin-Yu/PaDoc \
  --device cuda:0 \
  --execution-mode parallel \
  --max-concurrent-branches 8

The Space uses direct PyTorch inference rather than starting the local FastAPI server because ZeroGPU allocates a GPU only while the decorated Gradio request is active.

API

The streaming endpoint is named /parse:

from gradio_client import Client, handle_file

client = Client("TonyZhan/PaDoc")
job = client.submit(
    handle_file("document.png"),
    "Parse this document.",
    api_name="/parse",
)
for update in job:
    print(update)

Configuration

The defaults mirror the supported PaDoc dashboard path:

Variable Default
MODEL_ID Longin-Yu/PaDoc
MAX_NEW_TOKENS 512
MAX_BRANCH_TOKENS 512
MAX_CONCURRENT_BRANCHES 8
MAX_TOTAL_BRANCHES 64

Model weights are licensed under CC-BY-NC-4.0.