Spaces:
Running on Zero
Running on Zero
File size: 2,606 Bytes
f66bbd0 cb6ac42 f66bbd0 da4f3b2 cb6ac42 da4f3b2 f66bbd0 cb6ac42 f66bbd0 cb6ac42 0a40ab8 f66bbd0 cb6ac42 f66bbd0 0a40ab8 f66bbd0 cb6ac42 f66bbd0 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | ---
title: GazeCorrect
emoji: 👁️
colorFrom: blue
colorTo: red
sdk: gradio
sdk_version: 4.44.1
app_file: app.py
pinned: false
license: mit
short_description: Gaze-guided Gaussian-noise image regeneration
hf_oauth: true
hf_oauth_scopes:
- gated-repos
---
# GazeCorrect — Gaze-Guided Regeneration
Interactive demo that converts clinician gaze into a duration-weighted Gaussian
attention map. It previews Gaussian noise in the attended region, then uses a
text description to generate a chest X-ray with RoentGen-v2 and composites its
corresponding region into the uploaded image. No DINOv3 or segmentation
pipeline is used.
## How to use
1. Upload a chest X-ray.
2. Click gaze points or upload a CSV containing `x,y,duration`.
3. Enter a disease or radiology description.
4. Press **Generate** to receive the gaze attention map, attention-weighted
Gaussian-noise image, and corrected regenerated image.
## Synthetic chest X-ray correction
Install the additional inference dependencies:
```bash
pip install -U diffusers transformers accelerate
```
RoentGen-v2 is a gated text-to-image model. Before using the correction
button, sign in to Hugging Face and accept the model's access conditions. The
app uses its supported `DiffusionPipeline` inference path, then applies the
gaze mask when compositing the generated CXR region. The model and its outputs
are for research/education only, never for clinical diagnosis.
### Deploying on Hugging Face Spaces
The Space must have GPU hardware selected. In **Settings → Secrets**, add an
`HF_TOKEN` secret created by the Hugging Face account that accepted access to
`stanfordmimi/RoentGen-v2`. The token is read server-side and is never shown in
the web interface. The first correction request downloads the model, so it can
take several minutes; the interface displays the attention-weighted Gaussian
noise preview immediately if RoentGen cannot start.
For a **ZeroGPU** Space, this application already decorates the segmentation
and correction callbacks with `@spaces.GPU`. Keep `app.py` unchanged at the
top level; removing those decorators causes the ZeroGPU startup error
“No @spaces.GPU function detected”.
## Notes
- RoentGen-v2 is trained for chest X-rays; do not use this workflow for other
medical modalities.
- The first generation downloads the model. A GPU or ZeroGPU Space is
recommended.
- This Space is for research/demonstration only — it is **not** a clinical
diagnostic tool.
Full code, configs, and the unified evaluation pipeline:
[GitHub repository](https://github.com/<your-org>/gazerefine).
|