# LLM Leaderboard Demo

This demo showcases a modern LLM leaderboard application built with Gradio and FastAPI.

## Features

- Displays a sortable, filterable table of LLM models and their performance
- Shows scores across multiple benchmarks
- External links to model documentation for both open and closed models
- Dynamic filtering by model performance categories
- Real-time data refresh functionality
- Last-updated timestamp display
- Automatic startup of both API and frontend

## Installation

First, install the required dependencies:

```bash
pip install -r requirements.txt
```

## Usage

There are two ways to run the application:

### Option 1: Using run.py (all-in-one)

```bash
python run.py
```

This will start both the FastAPI backend and Gradio interface in a single process.

### Option 2: Using run_all.py (separate processes)

```bash
python run_all.py
```

This runs the API server and Gradio interface in separate processes, making it easier to debug each component.

With either option, the application will be available at:
- Frontend: http://localhost:7860
- API: http://localhost:8000

## Architecture

The application consists of two main components:

1. **FastAPI Backend** (`api.py`):
   - Provides API endpoints for leaderboard data
   - Caches data to improve performance
   - Handles data processing and filtering

2. **Gradio Frontend** (`run.py`):
   - Creates an interactive web interface
   - Fetches data from the API
   - Provides filtering and search capabilities

## API Endpoints

- `GET /api/leaderboard` - Get the full leaderboard data
- `GET /api/leaderboard?refresh=true` - Force refresh data from source
- `GET /api/models` - Get a list of all model names
- `GET /api/model/{model_name}` - Get details for a specific model
- `GET /api/filters` - Get counts for different filter categories

## Customization

You can modify the appearance by editing the CSS in `run.py`. The application uses Gradio's theme system for styling.

## License

This project is licensed under the MIT License.