File size: 1,624 Bytes
51e834c
bda3c09
 
51e834c
 
 
bda3c09
51e834c
 
bda3c09
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
---
title: BioStack - RLHF Medical Report Generation
emoji: 🩻
colorFrom: blue
colorTo: indigo
sdk: docker
app_port: 7860
---

# BioStack - RLHF Medical Report Generation

AI-powered medical report generation using Reinforcement Learning from Human Feedback (RLHF).

## Features
- **SFT Model**: Supervised Fine-Tuning for initial report generation
- **Reward Model**: Quality assessment of generated reports
- **PPO Model**: Policy optimization for improved outputs
- **Modern UI**: Clean React interface with drag-and-drop upload

## Models Used
- **SFT Model**: `best_model.pt` - Initial report generation
- **Reward Model**: `reward_model.pt` - Quality scoring
- **PPO Model**: `rlhf_model.pt` - Optimized generation

All models are automatically downloaded from Hugging Face Hub on first startup.

## Usage
1. Upload a medical X-ray image
2. Optionally provide ground truth text for comparison
3. Click "Run Inference" to generate reports
4. View results from all three models with quality scores

## Technology Stack
- **Frontend**: React.js
- **Backend**: FastAPI (Python)
- **ML Framework**: PyTorch, Transformers
- **Models**: T5, CoAtNet, Custom Reward Model

## Local Development

### Prerequisites
- Python 3.11+
- Node.js 16+
- Hugging Face account with access tokens

### Installation
```bash
# Install Python dependencies
pip install -r requirements.txt

# Install Node dependencies
npm install

# Build React app
npm run build

# Run server
python server.py
```

The app will be available at `http://localhost:7860`

## Deployment
This app is configured for deployment on Hugging Face Spaces using Docker.