# ══════════════════════════════════════════════════════════════════════════════ # Blueprint Room Extractor — requirements.txt # Target: Hugging Face Spaces (NVIDIA T4 / A10G GPU runtime) # # Install order matters — torch must come before torchvision/torchaudio and # before segment-anything / easyocr so they all link against the same libcuda. # # To run locally with GPU: # pip install -r requirements.txt # # To run locally CPU-only (fallback): # pip install -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cpu # ══════════════════════════════════════════════════════════════════════════════ # ── Web framework ───────────────────────────────────────────────────────────── flask>=3.0.0 werkzeug>=3.0.0 # ── Core numerics ───────────────────────────────────────────────────────────── numpy>=1.26.0,<3.0 scipy>=1.12.0 scikit-image>=0.22.0 pillow>=10.0.0 # ── OpenCV (CUDA-enabled build via headless + contrib) ──────────────────────── # opencv-python-headless is the standard HF Spaces variant (no GTK/Qt deps). # The opencv-contrib-python-headless build ships ximgproc (thinning) and # cuda* modules when the underlying system has libcuda.so. # On CPU-only machines both packages fall back gracefully; cv2.cuda # functions will raise RuntimeError which we catch and route to CPU. opencv-contrib-python-headless>=4.9.0.80 # ── PyTorch — CUDA 12.1 wheel (HF Spaces default CUDA version) ─────────────── # HF Spaces hardware: NVIDIA T4 (sm_75) or A10G (sm_86), CUDA 12.x torch>=2.3.0 torchvision>=0.18.0 torchaudio>=2.3.0 # ── CuPy — GPU NumPy (matches CUDA 12.x on HF Spaces) ──────────────────────── # Provides cp.asarray / cp.asnumpy for zero-copy GPU↔CPU transfers and # replaces NumPy hotspots (chroma erase, RLE encoding, gap analysis) on GPU. cupy-cuda12x>=13.0.0 # ── Segment Anything Model (SAM) ────────────────────────────────────────────── # Facebook's original SAM — predictor.predict() runs on CUDA when available. # Checkpoint (vit_h ~2.4 GB) is downloaded at runtime from HF Hub. git+https://github.com/facebookresearch/segment-anything.git # ── OCR — EasyOCR with GPU support ─────────────────────────────────────────── # EasyOCR uses its own torch-based CRNN; when torch.cuda.is_available() it # automatically moves tensors to GPU without any code change. easyocr>=1.7.1 # ── ONNXRuntime GPU (optional accelerator for EasyOCR detection backbone) ───── # EasyOCR's detection model can run via onnxruntime-gpu if present. onnxruntime-gpu>=1.18.0 # ── Hugging Face integration ────────────────────────────────────────────────── # huggingface_hub: model download (SAM checkpoint) # spaces: @spaces.GPU decorator for zero-GPU billing on HF Spaces free tier huggingface_hub>=0.23.0 spaces>=0.29.0 # ── Enchant spell checker (room-label validation) ───────────────────────────── # Requires system package: apt-get install libenchant-2-dev (add to packages.txt) pyenchant>=3.2.2 # ── Miscellaneous utilities ─────────────────────────────────────────────────── # imageio: used by skimage internally imageio>=2.34.0 # tqdm: progress bars inside EasyOCR / SAM tqdm>=4.66.0 # requests: SAM checkpoint download fallback requests>=2.31.0 openpyxl