| --- |
| title: DR Clinical Report Generator |
| emoji: 🩺 |
| colorFrom: blue |
| colorTo: green |
| sdk: gradio |
| app_file: app.py |
| pinned: false |
| license: mit |
| --- |
| |
| # Diabetic Retinopathy Clinical Report Generator |
|
|
| Upload a retinal fundus image. A trained EfficientNet-B4 + Swin Transformer model |
| grades diabetic-retinopathy severity (0 to 4), and Gemini drafts a structured |
| clinical report around that grade. |
|
|
| > WARNING: Research and education demo only. NOT for clinical use. Both the grade |
| > and the report are automated and must be reviewed by a qualified ophthalmologist. |
|
|
| ## Try it |
|
|
| Upload a fundus photograph and click Analyze. You will see: |
|
|
| - the predicted DR grade (No DR, Mild, Moderate, Severe, or Proliferative) |
| - a per-class severity probability bar |
| - the preprocessed image (fundus crop + CLAHE) |
| - an AI-generated clinical report (interpretation, observable features, follow-up, |
| and caveats) |
|
|
| ## How it works |
|
|
| A specialist computer-vision model produces the grade; a vision-language LLM only |
| writes the report around that fixed grade. The diagnosis is never left to the LLM. |
|
|
| ``` |
| fundus image -> crop + CLAHE -> EfficientNet-B4 + Swin (CORN) -> grade 0-4 |
| grade + image -> Gemini -> structured clinical report |
| ``` |
|
|
| ## Run your own / source code |
|
|
| Full source and setup instructions are on GitHub: |
| https://github.com/BilalAhmadSami/DR-Clinical-Report-Generator |
|
|
| To self-host or fork this Space you need a free Gemini API key |
| (https://aistudio.google.com) set as a `GEMINI_API_KEY` secret. |
|
|