| # Pinned to the version verified locally (Python 3.13). When deploying, set the |
| # HF Space README `sdk_version` to match. If the Space's Gradio SDK only supports |
| # <=5.x, repin here AND move `theme` back into gr.Blocks(...) in app.py. |
| # |
| # This is the LIGHT set the HF Space installs for the stub-mode demo (the default). |
| # Heavy real-model deps (torch/transformers/...) live in requirements-model.txt so |
| # the Space build stays fast — nothing heavy is imported at module load in stub mode |
| # (llm.py imports torch/transformers only inside _load(); pypdf is imported lazily). |
| # |
| # gradio is pinned to 6.10.0 because the custom-frontend server (server.py) uses |
| # `gradio.Server`. On newer gradio (6.17.x) a custom gradio.Server breaks under the |
| # Space runtime — the app starts but the Space flips to RUNTIME_ERROR. 6.10.0 is a |
| # version gradio's `Server` examples ship and runs cleanly here. (The official |
| # MiniCPM-V-4.6 demo uses 6.14.0 with the same pattern, so 6.10–6.14 is the known- |
| # good band; 6.10.0 is what we verified.) |
| # |
| # It also resolves with the real model: 6.10.0 allows huggingface-hub <2.0,>=0.33.5, |
| # i.e. hub 1.x, which MiniCPM-V 4.6's modern transformers (5.x) wants. (The old |
| # huggingface-hub<1.0 constraint was specific to the retired MiniCPM4.1-8B text |
| # model and no longer applies — see requirements-model.txt.) |
| # |
| # A gradio-SDK Space force-installs sdk_version's gradio for the WHOLE Space, so |
| # stub + real-model share one gradio. Keep this in lockstep with the README |
| # `sdk_version` and requirements-model.txt. |
| gradio==6.10.0 |
| # server.py (custom frontend) — FastAPI/uvicorn are pulled in by gradio, but we |
| # pin them explicitly so the Space is self-documenting and robust to drift. |
| fastapi |
| uvicorn |
| # Needed for the PDF upload endpoint. |
| python-multipart |
| # PDF text extraction (pure-python, lightweight). |
| pypdf |
|
|
| # --- Real model (MiniCPM-V 4.6), folded in for the LIVE real-model deploy ----- |
| # A gradio Space installs THIS file (not requirements-model.txt), so the heavy |
| # deps live here now that the Space serves the real model on ZeroGPU with |
| # RECALL_STUB=0. Verified to resolve with gradio==6.10.0 (HF Job, l4x1): |
| # transformers 5.12 + huggingface-hub 1.19 + torch 2.12. See requirements-model.txt |
| # for the rationale; keep the two in lockstep. |
| transformers>=4.44.0 # native MiniCPMV4_6ForConditionalGeneration (latest 5.x) |
| torch |
| torchvision # vision tower; must match torch |
| accelerate |
| sentencepiece # MiniCPM-V tokenizer backend |
| pillow # images passed to the model as PIL.Image |
| PyMuPDF # render scanned/image-only PDF pages -> images |
| spaces # HF ZeroGPU @spaces.GPU decorator |
|
|