Delete CLAUDE.md
Browse files
CLAUDE.md
DELETED
@@ -1,115 +0,0 @@
|
|
1 |
-
# CLAUDE.md
|
2 |
-
|
3 |
-
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
4 |
-
|
5 |
-
## Project Overview
|
6 |
-
|
7 |
-
This is a FastAPI-based web dashboard that scrapes and compares monthly request statistics from AI inference providers' HuggingFace profiles. The application uses async web scraping with aiohttp and BeautifulSoup to fetch data concurrently, then displays it in a modern responsive dashboard with Chart.js visualizations.
|
8 |
-
|
9 |
-
## Architecture
|
10 |
-
|
11 |
-
- **Backend**: FastAPI application (`app.py`) with async endpoints
|
12 |
-
- **Frontend**: Single HTML template (`templates/dashboard.html`) with embedded CSS/JS
|
13 |
-
- **Data Source**: Web scraping from HuggingFace provider profiles
|
14 |
-
- **Visualization**: Chart.js for bar charts and interactive elements
|
15 |
-
|
16 |
-
### Key Components
|
17 |
-
|
18 |
-
- `get_monthly_requests()`: Async function that scrapes individual provider data from HuggingFace
|
19 |
-
- Provider list (`PROVIDERS`): Hardcoded list of AI inference providers to track
|
20 |
-
- API endpoints: `/api/providers` (all data) and `/api/providers/{provider}` (single provider)
|
21 |
-
- Dashboard auto-refreshes every 10 minutes with manual refresh capability
|
22 |
-
|
23 |
-
## Development Commands
|
24 |
-
|
25 |
-
### Running the Application
|
26 |
-
```bash
|
27 |
-
# Start development server
|
28 |
-
python app.py
|
29 |
-
|
30 |
-
# Or using uvicorn directly
|
31 |
-
uvicorn app:app --host 0.0.0.0 --port 8000 --reload
|
32 |
-
```
|
33 |
-
|
34 |
-
### Installing Dependencies
|
35 |
-
```bash
|
36 |
-
pip install -r requirements.txt
|
37 |
-
```
|
38 |
-
|
39 |
-
### Docker Support
|
40 |
-
```bash
|
41 |
-
# Build and run with Docker
|
42 |
-
docker build -t inference-dashboard .
|
43 |
-
docker run -p 8000:7860 inference-dashboard
|
44 |
-
```
|
45 |
-
|
46 |
-
## API Endpoints
|
47 |
-
|
48 |
-
- `GET /` - Main dashboard interface
|
49 |
-
- `GET /api/providers` - Returns all provider data with stats
|
50 |
-
- `GET /api/providers/{provider}` - Returns specific provider data
|
51 |
-
|
52 |
-
## Configuration
|
53 |
-
|
54 |
-
To add new providers, edit the `PROVIDERS` list in `app.py`. Providers must have valid HuggingFace profiles that display monthly request statistics.
|
55 |
-
|
56 |
-
## Key Dependencies
|
57 |
-
|
58 |
-
- **FastAPI**: Web framework with async support
|
59 |
-
- **aiohttp**: Async HTTP client for concurrent scraping
|
60 |
-
- **BeautifulSoup4**: HTML parsing for web scraping
|
61 |
-
- **Jinja2**: Template rendering
|
62 |
-
- **Chart.js**: Client-side charting (CDN)
|
63 |
-
|
64 |
-
## Development Notes
|
65 |
-
|
66 |
-
- All data fetching is async to handle multiple provider requests concurrently
|
67 |
-
- Error handling gracefully degrades when provider data is unavailable
|
68 |
-
- Frontend uses requestAnimationFrame for smooth DOM updates
|
69 |
-
- Responsive design supports mobile devices
|
70 |
-
- No authentication or rate limiting implemented
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
There is a .env file in the project root that has the following environment variables
|
75 |
-
|
76 |
-
HF_TOKEN - to be used to upload files to the HF Hub
|
77 |
-
DATASET_REPO_NAME - the repo name for the dataset on the HF Hub
|
78 |
-
SPACE_REPO_NAME - the repo name for the space hosting the app
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
## Creating a Hugging Face space
|
83 |
-
|
84 |
-
https://huggingface.co/docs/huggingface_hub/guides/manage-spaces
|
85 |
-
|
86 |
-
|
87 |
-
## Creating a dataset
|
88 |
-
|
89 |
-
The dataset will be stored at nbroad/hf-inference-providers-data.
|
90 |
-
|
91 |
-
```python
|
92 |
-
from datasets import load_dataset, concatenate_dataset, Dataset
|
93 |
-
|
94 |
-
dataset_repo_name = "nbroad/hf-inference-providers-data"
|
95 |
-
|
96 |
-
ds = load_dataset(dataset_repo_name, split="train")
|
97 |
-
|
98 |
-
df = ds.to_pandas()
|
99 |
-
|
100 |
-
|
101 |
-
new_row = pd.DataFrame({})
|
102 |
-
# add row
|
103 |
-
df = pd.concat([
|
104 |
-
df,
|
105 |
-
new_row
|
106 |
-
],
|
107 |
-
axis=0,
|
108 |
-
ignore_index=True
|
109 |
-
)
|
110 |
-
|
111 |
-
new_ds = Dataset.from_pandas(df)
|
112 |
-
|
113 |
-
new_ds.push_to_hub(dataset_repo_name, private=False)
|
114 |
-
|
115 |
-
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|