Smith42 commited on
Commit
e612d67
Β·
1 Parent(s): 880af1c

Updated with instructions

Browse files
Files changed (1) hide show
  1. README.md +64 -3
README.md CHANGED
@@ -3,11 +3,72 @@ title: Perihelion
3
  emoji: 🌌
4
  colorFrom: blue
5
  colorTo: pink
6
- sdk: gradio
7
- sdk_version: 6.9.0
8
  app_file: app.py
9
  pinned: false
10
  short_description: Which galaxy is right for you?
11
  ---
12
 
13
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  emoji: 🌌
4
  colorFrom: blue
5
  colorTo: pink
6
+ sdk: docker
 
7
  app_file: app.py
8
  pinned: false
9
  short_description: Which galaxy is right for you?
10
  ---
11
 
12
+ # Perihelion
13
+
14
+ Vote on pairs of galaxy images to build a community ELO ranking of the most interesting galaxies.
15
+
16
+ ## Environment variables
17
+
18
+ ### Local development
19
+
20
+ Create a `.env` file in the project root (never commit this):
21
+
22
+ ```
23
+ # HuggingFace β€” required for persistent ELO state across restarts
24
+ HF_TOKEN=hf_...
25
+ HF_LOG_REPO_ID=your-username/perihelion-logs
26
+
27
+ # Optional
28
+ HF_LOG_EVERY_MINUTES=10
29
+
30
+ # Dataset
31
+ DATASET_ID=mwalmsley/gz_euclid
32
+ DATASET_CONFIG=default
33
+ DATASET_SPLIT=train
34
+ IMAGE_COLUMN=image
35
+ ID_COLUMN=id_str
36
+ POOL_SIZE=5000
37
+ POOL_SEED=42
38
+
39
+ # Image cache
40
+ IMAGE_CACHE_DIR=cache/images
41
+ IMAGE_CACHE_MAX_BYTES=524288000
42
+ ```
43
+
44
+ Then run:
45
+
46
+ ```bash
47
+ uv run python app.py
48
+ ```
49
+
50
+ ### HuggingFace Spaces
51
+
52
+ Set variables in **Settings β†’ Variables and secrets** for your Space:
53
+
54
+ | Variable | Where to set | Description |
55
+ |---|---|---|
56
+ | `HF_TOKEN` | **Secrets** | HuggingFace token with read/write access to `HF_LOG_REPO_ID` |
57
+ | `HF_LOG_REPO_ID` | Variables | Dataset repo for persisting ELO state, e.g. `your-username/perihelion-logs` |
58
+ | `HF_LOG_EVERY_MINUTES` | Variables | How often to sync state to HF Hub (default: `10`) |
59
+ | `DATASET_ID` | Variables | HF dataset to sample galaxies from (default: `mwalmsley/gz_euclid`) |
60
+ | `DATASET_CONFIG` | Variables | Dataset config name (default: `default`) |
61
+ | `DATASET_SPLIT` | Variables | Dataset split (default: `train`) |
62
+ | `IMAGE_COLUMN` | Variables | Name of the image column (default: `image`) |
63
+ | `ID_COLUMN` | Variables | Name of the ID column for display names (default: `id_str`) |
64
+ | `POOL_SIZE` | Variables | Number of galaxies to sample (default: `5000`) |
65
+ | `POOL_SEED` | Variables | Shuffle seed β€” keep this fixed so all participants see the same pool (default: `42`) |
66
+ | `IMAGE_CACHE_MAX_BYTES` | Variables | Max disk space for image cache in bytes (default: `524288000` = 500 MB) |
67
+
68
+ > **Note:** `HF_TOKEN` must be added as a **Secret** (not a variable) to keep it private.
69
+
70
+ ### Persistent ELO state
71
+
72
+ ELO scores are written to `state/elo_state.json` on every comparison and periodically synced to HF Hub. The saved state is matched to `DATASET_ID` β€” if you change the dataset, old state is automatically discarded and a fresh ranking starts.
73
+
74
+ Without `HF_LOG_REPO_ID` set, state is only saved locally and will be lost on container restart.