CoolFace
Apppublic

build-small-hackathon/ct-app

sourceHugging Faceapache-2.0updated 3mo agoView on Hugging Face
2likes
App README

๐Ÿฉป CT Report Generator

An automated 3D volumetric reporting pipeline for CT scans, powered by TotalSegmentator (3D U-Net) (โšก ~30 Million Total Parameters) โ€” deployed serverlessly on Modal.
๐Ÿ“บ [Watch the full video demo and post on X (Twitter)!](https://x.com/AKIS23820044161/status/2066586748541657272)
Special Bonus Targets : Tiny Titan (~30M parameters model) ยท Off-Brand Award

๐Ÿ“– Overview

CT report generator is a Gradio-based clinical dashboard that automates the extraction and quantification of anatomical structures from 3D CT scans. It processes raw .nii / .nii.gz volumetric data, calculates the exact volume of dozens of internal organs, and automatically flags any measurements that fall outside of expected healthy reference ranges (e.g., hepatomegaly, splenomegaly, or asymmetrical kidneys).


๐Ÿš€ Features

FeatureDescription
๐Ÿง  Total Body SegmentationAutomatically identifies and segments major solid organs, thoracic structures, and GI/GU tracts.
๐Ÿ“Š Clinical Volume AlertsCross-references organ volumes with normal adult reference ranges and flags anomalies (e.g. Enlarged liver, asymmetric lungs).
๐Ÿ–ผ๏ธ Cross-Section PreviewGenerates an immediate mid-axial visual slice of the uploaded 3D volume.
๐Ÿ“‘ PDF Report GenerationAutomatically compiles the findings into a clean, professional, downloadable PDF clinical report using WeasyPrint.

๐Ÿค– AI Models Used

1. TotalSegmentator โ€” 3D Anatomical Segmentation

  • โ€”Architecture: 3D U-Net (nnU-Net framework)
  • โ€”Total Parameters: ~30 Million (30M)
  • โ€”Task: 3D medical image segmentation.
  • โ€”Used for: Identifying and calculating the exact cubic centimeter (cmยณ) volume of 100+ anatomical structures from raw CT scans.
  • โ€”Inference: Fast-mode enabled for rapid screening on Modal A10G GPU.

๐Ÿ—๏ธ Architecture

GRADIO FRONTEND (app.py)
  โ”œโ”€โ”€ 3D Visualization     โ†’ nibabel + PIL (Mid-axial slice rendering)
  โ”œโ”€โ”€ Validation           โ†’ Checks for valid 3D shape and intensity spread
  โ”œโ”€โ”€ PDF Generation       โ†’ WeasyPrint HTML-to-PDF conversion
  โ””โ”€โ”€ Remote RPC           โ†’ Connects to Modal backend via `modal.Cls`

MODAL SERVERLESS BACKEND (backend.py)
  โ””โ”€โ”€ Segmenter [A10G]     โ†’ `TotalSegmentator` subprocess
                           โ†’ JSON parsing & Reference Range Logic
                           โ†’ Returns structured clinical findings

๐Ÿ–ฅ๏ธ GPU Resources (Modal)

ContainerGPUModel(s)Purpose
SegmenterA10G (24GB)TotalSegmentator 3D U-NetHeavy volumetric segmentation and pixel quantification

โš™๏ธ Setup & Deployment

bash
# 1. Install dependencies
python -m venv venv && source venv/bin/activate
pip install -r requirements.txt

# 2. Deploy Modal backend
modal deploy backend.py

# 3. Run the Gradio frontend
python app.py
build-small-hackathon/ct-app ยท CoolFace