File size: 2,791 Bytes
bd08f1f
 
 
 
 
 
 
 
 
 
e41e908
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
---
title: Inference Provider Dashboard
emoji: πŸ“Š
colorFrom: blue
colorTo: purple
sdk: docker
pinned: false
license: mit
---

# Inference Provider Dashboard

A modern web dashboard built with FastAPI that compares monthly requests between different AI inference providers by scraping data from their HuggingFace profiles.

## Features

- **Real-time Data**: Scrapes monthly request statistics from HuggingFace profiles
- **Beautiful UI**: Modern, responsive dashboard with charts and tables
- **API Endpoints**: RESTful API for accessing provider data programmatically
- **Auto-refresh**: Dashboard automatically updates every 5 minutes
- **Async Performance**: Uses async/await for efficient concurrent data fetching

## Screenshots

The dashboard includes:
- Statistics cards showing total providers, total requests, and top provider
- Interactive bar chart comparing monthly requests
- Detailed table with provider information and links to HuggingFace profiles

## Installation

1. **Clone or navigate to the project directory**

2. **Install dependencies**:
   ```bash
   pip install -r requirements.txt
   ```

## Usage

1. **Start the FastAPI server**:
   ```bash
   python app.py
   ```
   
   Or using uvicorn directly:
   ```bash
   uvicorn app:app --host 0.0.0.0 --port 8000 --reload
   ```

2. **Open your browser and navigate to**:
   ```
   http://localhost:8000
   ```

3. **API Endpoints**:
   - `GET /` - Dashboard web interface
   - `GET /api/providers` - Get all providers data
   - `GET /api/providers/{provider}` - Get specific provider data

## API Examples

**Get all providers data**:
```bash
curl http://localhost:8000/api/providers
```

**Get specific provider data**:
```bash
curl http://localhost:8000/api/providers/togethercomputer
```

## Configuration

To add more providers, edit the `PROVIDERS` list in `app.py`:

```python
PROVIDERS = [
    "togethercomputer",
    "fireworks-ai",
    "your-new-provider",
]
```

## Project Structure

```
inference_provider_dashboard/
β”œβ”€β”€ app.py                 # FastAPI application
β”œβ”€β”€ templates/
β”‚   └── dashboard.html     # Web dashboard template
β”œβ”€β”€ requirements.txt       # Python dependencies
└── README.md             # This file
```

## Dependencies

- **FastAPI**: Modern web framework for building APIs
- **Uvicorn**: ASGI server for running FastAPI
- **Jinja2**: Template engine for HTML rendering
- **aiohttp**: Async HTTP client for concurrent requests
- **BeautifulSoup4**: HTML parsing for web scraping
- **Requests**: HTTP library (fallback)

## Development

The application uses:
- Async/await for concurrent HTTP requests
- Chart.js for interactive visualizations
- Modern CSS with gradients and animations
- Responsive design for mobile devices

## License

MIT License