--- title: Medical Deepfake Detector emoji: 🩻 colorFrom: blue colorTo: indigo sdk: gradio sdk_version: 6.2.0 python_version: "3.10.13" app_file: app.py pinned: false --- # Medical Deepfake Detector Hugging Face ZeroGPU Space for single-image medical deepfake detection. ## What It Does - Upload one image or select an example from `imgs/` - Resize to `1024x1024` before inference - Run the Hugging Face model with the same `transformers` inference path as `infer_single_image_transformers.py` - Parse the `deepfake` bounding box from model output - Map the box back to the original image and render the result ## Required Configuration Set these in Space `Settings -> Variables and secrets`. - `MODEL_ID`: Hugging Face model repo id used by `from_pretrained` if you want to override the default - `HF_TOKEN`: required only when the model repo is private `MODEL_ID` is the single source of truth for model selection. If it is not set, the app uses `RichardChenZH/MedForge-Reasoner`. ## Example Gallery - Example images are loaded from the repo `imgs/` directory - Supported suffixes: `.png`, `.jpg`, `.jpeg`, `.webp`, `.bmp` - Invalid files such as `.DS_Store` are ignored - Add, replace, or delete examples by editing `imgs/` only ## Runtime Behavior - `@spaces.GPU(...)` wraps the model loading and generation path used by the Space - Image resize, bbox parsing, reverse scaling, and drawing follow `infer_single_image_transformers.py` - ZeroGPU-compatible runtime pins are declared in `requirements.txt` - Missing bbox or invalid bbox math fails fast instead of silently returning a fallback result ## Local Run ```bash source /opt/miniconda3/etc/profile.d/conda.sh conda activate base pip install -r requirements.txt python app.py ``` If you want to override the default model repo, set `MODEL_ID` before launching.