File size: 1,482 Bytes
3469608
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
---
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.