Spaces:
Runtime error
Runtime error
|
Download README.md from Gopal05/Report-Generatio-System-Radiology: direct link, hf CLI and curl.
- Browser
- Download file 3.31 kB
-
https://huggingface.co/spaces/Gopal05/Report-Generatio-System-Radiology/resolve/main/README.md
- Command line
-
hf download hf://spaces/Gopal05/Report-Generatio-System-Radiology/README.md
-
curl -L -o README.md https://huggingface.co/spaces/Gopal05/Report-Generatio-System-Radiology/resolve/main/README.md
3.31 kB
metadata
license: mit
title: Radiology Report Generation System
sdk: docker
emoji: π’
colorFrom: blue
colorTo: green
Radiology AI Report Generation System v2.0
AI-powered radiology report generation using BLIP-2 vision + Phi-2 LLM fine-tuned on real radiology reports.
What it does
- Upload any radiology image (X-ray, CT, MRI, Ultrasound, PET, Mammography, etc.)
- BLIP-2 reads the actual image and describes what it sees
- Phi-2 (fine-tuned on 227,835 real radiology reports) generates a structured report
- Outputs: FINDINGS, IMPRESSION, RECOMMENDATIONS + UMLS/ICD-10/SNOMED CT codes
Requirements
- Windows 10/11
- Python 3.10
- NVIDIA GPU with 8GB+ VRAM (RTX 4060 or better)
- CUDA 12.8
- 20GB free disk space (for models)
Quick Start
Step 1 β Setup (run once)
Double-click: setup.bat
This creates venv, installs all dependencies, verifies GPU.
Step 2 β Fine-tune (run once, ~35 minutes)
Double-click: run_training.bat
Downloads unsloth/Radiology_mini (227,835 real reports) and fine-tunes Phi-2.
Step 3 β Start the system
Terminal 1:
run_backend.bat
Terminal 2:
run_frontend.bat
Step 4 β Use the system
Open browser: http://localhost:7860
Manual commands (if .bat files don't work)
cd D:\radiology_ai_system
venv\Scripts\activate
# Backend
set USE_4BIT=true
set ENABLE_VISION_CAPTION=true
uvicorn backend.main:app --reload --host 0.0.0.0 --port 8000
# Frontend (new terminal)
venv\Scripts\activate
python frontend/ui.py
# Fine-tuning (Git Bash)
python training/train_unsloth.py --max_steps 300
Project Structure
radiology_ai_system/
βββ backend/
β βββ main.py # FastAPI endpoints
β βββ model_loader.py # BLIP-2 + Phi-2 loading
β βββ preprocessing.py # Image preprocessing (9 modalities)
β βββ report_generator.py # Report generation + parsing
β βββ validation_module.py # Report quality scoring
β βββ medical_coding.py # UMLS/ICD-10/SNOMED CT
βββ frontend/
β βββ ui.py # Gradio UI
βββ training/
β βββ train_unsloth.py # Fine-tuning on Radiology_mini
β βββ prepare_dataset.py # Dataset preparation
β βββ evaluate_model.py # Model evaluation
βββ models/
β βββ slm_model/ # Phi-2 cached here
β β βββ lora_adapter/ # Fine-tuned LoRA adapter saved here
β βββ vision_encoder/ # BLIP-2 cached here
βββ setup.bat # One-time setup
βββ run_backend.bat # Start backend
βββ run_frontend.bat # Start frontend
βββ run_training.bat # Fine-tune model
βββ requirements.txt
VRAM Usage
| Component | VRAM |
|---|---|
| Phi-2 (4-bit) | ~2.0GB |
| BLIP-2 | ~3.5GB |
| Total | ~5.5GB |
| Available | 8.6GB β |
API Endpoints
- POST /api/generate-report β Generate report from image
- GET /api/report/{id} β Get stored report
- GET /api/export/pdf/{id} β Download PDF
- GET /api/export/json/{id} β Download JSON
- GET /api/health β System health
- GET /docs β Swagger UI (http://localhost:8000/docs)