File size: 2,148 Bytes
936658d
 
cfbec3f
 
 
936658d
 
 
 
 
cfbec3f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
title: Training Process
emoji: πŸ“ˆ
colorFrom: gray
colorTo: red
sdk: static
pinned: false
license: mit
---

# RL Training Dashboard (static)

Plain HTML, CSS and JavaScript. No build step, no React. Public visitors see the data. The owner (`mondk`) signs in with Hugging Face and can edit the cost counter, notices, about text and raw JSON.

## Files

- `index.html`: entry page
- `style.css`: dark theme, light toggle
- `config.js`: constants (client ID, owner, data repo, timezones)
- `cost.js`: cost counter math (pure functions)
- `hf.js`: Hugging Face login (PKCE), read and write of `dashboard.json`
- `app.js`: rendering, charts, admin panels

## Setup

1. **Create the OAuth app** (logged in as `mondk`): huggingface.co β†’ Settings β†’ Applications β†’ New OAuth application.
   - Redirect URLs: add `http://localhost:8000/` (for local testing) and the Space URL, for example `https://noodcon-training-process.hf.space/`. The URL must match exactly, including the trailing slash.
   - Scopes: `openid`, `profile`, `write-repos`.
   - Copy the **Client ID**.
2. **Fill in `config.js`**: set `HF_OAUTH_CLIENT_ID`. Check that `OWNER_HF_USERNAME` is `mondk` and `DATA_REPO` is `mondk/Test`.
3. **Upload the files** to the Space: open the Space, go to Files β†’ Add file β†’ Upload files, and upload every file in this folder (or push them with git). Keep the files at the root of the repo.
4. **Open the direct URL** `https://<space-name>.hf.space` and not the preview inside huggingface.co. The preview is an iframe and can block the login session.

## Test locally

Run a small server from this folder, not by double-clicking `index.html` (modules and OAuth need http):

```
python3 -m http.server 8000
```

Then open `http://localhost:8000`.

## Notes

- The dataset `mondk/Test` is public. Do not put tokens or private data in `dashboard.json`.
- Admin edits save as a commit to the dataset. Visitors see them within `REFRESH_MS` (30 s).
- The owner's token is kept in `sessionStorage` and is removed by Log out or when the tab closes.
- If the browser blocks reading `dashboard.json` (CORS), tell me and I will switch the read path.