--- title: UNIStainNet - Virtual IHC Staining emoji: 🔬 colorFrom: blue colorTo: purple sdk: gradio sdk_version: "6.10.0" app_file: app.py pinned: false license: mit hardware: cpu-basic --- # UNIStainNet: Foundation-Model-Guided Virtual Staining Virtual staining of H&E histopathology images to IHC (HER2, Ki67, ER, PR) using a single unified 42M-parameter SPADE-UNet conditioned on dense spatial tokens from a frozen UNI pathology foundation model. ## Features - **Gallery** — Browse 16 pre-computed examples from BCI and MIST datasets (no GPU needed) - **Virtual Staining** — Upload an H&E image and generate any IHC stain (GPU required) - **Cross-Stain Comparison** — Generate all 4 stains from a single H&E input (GPU required) ## Architecture | Component | Details | |-----------|---------| | Generator | SPADE-UNet with UNI spatial conditioning + FiLM stain embeddings | | UNI Features | 4x4 sub-crop tiling → UNI ViT-L/16 → 32x32 spatial tokens (1024-dim) | | Parameters | 42M (generator), UNI frozen (303M) | ## GPU Support - **Gallery tab** works on CPU (default hardware) - **Live inference** requires GPU — set Space hardware to ZeroGPU (HF Pro) or run locally with `python app.py`