Spaces:
Running on Zero
Running on Zero
Download stemdeck/catalog.py from AnjaneyaTurai/stemdeck-gpu: direct link, hf CLI and curl.
- Browser
- Download file 1.96 kB
-
https://huggingface.co/spaces/AnjaneyaTurai/stemdeck-gpu/resolve/main/stemdeck/catalog.py
- Command line
-
hf download hf://spaces/AnjaneyaTurai/stemdeck-gpu/stemdeck/catalog.py
-
curl -L -o catalog.py https://huggingface.co/spaces/AnjaneyaTurai/stemdeck-gpu/resolve/main/stemdeck/catalog.py
1.96 kB
| """Stem names, labels, colours and display order (mirrors docs/API.md).""" | |
| from __future__ import annotations | |
| from dataclasses import dataclass | |
| class StemInfo: | |
| name: str | |
| label: str | |
| color: str | |
| order: int | |
| BASE_STEMS: tuple[StemInfo, ...] = ( | |
| StemInfo("lead_vocals", "Lead vocals", "#f472b6", 10), | |
| StemInfo("backing_vocals", "Backing vocals", "#c084fc", 20), | |
| StemInfo("drums", "Drums", "#fb923c", 30), | |
| StemInfo("bass", "Bass", "#60a5fa", 40), | |
| StemInfo("guitar", "Guitar", "#facc15", 50), | |
| StemInfo("piano", "Piano", "#34d399", 60), | |
| StemInfo("other", "Other", "#94a3b8", 1000), | |
| ) | |
| BASE_BY_NAME = {s.name: s for s in BASE_STEMS} | |
| EXTRA_LABELS: dict[str, str] = { | |
| "woodwinds": "Woodwinds", | |
| "kick": "Kick", | |
| "snare": "Snare", | |
| "toms": "Toms", | |
| "hihat": "Hi-hat", | |
| "ride": "Ride", | |
| "crash": "Crash", | |
| "male_vocals": "Male vocals", | |
| "female_vocals": "Female vocals", | |
| "flute": "Flute", | |
| "saxophone": "Saxophone", | |
| "brass": "Brass", | |
| "strings": "Strings", | |
| "sitar": "Sitar", | |
| "accordion": "Accordion / harmonium", | |
| "organ": "Organ", | |
| "synth": "Synth", | |
| "mandolin": "Mandolin", | |
| "harmonica": "Harmonica", | |
| } | |
| # Distinct from the base colours above; assigned in order to extra stems. | |
| EXTRA_PALETTE: tuple[str, ...] = ( | |
| "#2dd4bf", "#f87171", "#a3e635", "#38bdf8", "#e879f9", "#fbbf24", | |
| "#818cf8", "#4ade80", "#fb7185", "#22d3ee", "#d946ef", "#f97316", | |
| ) | |
| EXTRA_ORDER_START = 100 | |
| def extra_label(name: str, prompt: str | None = None) -> str: | |
| if prompt: | |
| return prompt[:1].upper() + prompt[1:] | |
| return EXTRA_LABELS.get(name, name.replace("_", " ").capitalize()) | |
| def pick_extra_color(used: set[str]) -> str: | |
| for color in EXTRA_PALETTE: | |
| if color not in used: | |
| return color | |
| return EXTRA_PALETTE[len(used) % len(EXTRA_PALETTE)] | |