XDL-Colitis-Demo / README.md
Arviano's picture
Add case-based model selection with new model set
a990302
|
Raw History Blame Contribute Delete
1.66 kB

A newer version of the Gradio SDK is available: 6.31.0

Upgrade
metadata
title: XDL Colitis Demo
emoji: 👁
colorFrom: pink
colorTo: red
sdk: gradio
sdk_version: 6.5.1
app_file: app.py
pinned: false

XDL Colitis Demo

Simple Gradio demo for DenseNet-based colitis image classification with optional XDL overlays.

Features

  • Batch inference only
  • Case selector:
    • Multiclass (4 Classes)
    • Crohn vs TB
    • Kolitis Ulseratif vs Infeksi
  • Folder upload support (gr.File directory upload)
  • Optional local folder-path input
  • Automatic device detection (cuda if available, else cpu)
  • Presentable summary card for key outputs (device, processed count, final class, mean confidence, etc.)
  • Final folder classification by majority vote of per-image top class
  • Mean confidence for the selected final class
  • Compact GradCAM + SmoothGrad overlays for classified images
  • Optional saving of compact XDL results to a local folder

Run

.venv/bin/python app.py

Then open the Gradio URL in your browser.

Project Structure

  • app.py: minimal launcher
  • src/ui.py: batch-only Gradio UI
  • src/inference.py: model loading + inference + batch/XDL pipeline
  • src/xdl.py: DenseNet-specific XDL helper functions
  • src/densenet.py: model definition
  • src/preprocessing.py: inference transform

Notes

  • Default model paths:
    • models/multiclass.pth (Multiclass)
    • models/crohn_tb.pth (Crohn vs TB)
    • models/ku_infeksi.pth (Kolitis Ulseratif vs Infeksi)
  • You can override model paths with env vars:
    • MODEL_PATH_MULTICLASS
    • MODEL_PATH_CROHN_TB
    • MODEL_PATH_KU_INFEKSI
  • If model loading fails, the UI returns a clear error instead of silently using random weights.