Spaces:
Running
Running
| """Single source of truth for which inference tag sources are surfaced in the UI. | |
| Both the Track Explorer (display) and the GT Review board (seed values) consult | |
| this registry so the two views stay in sync: phasing out an inference path is a | |
| single edit here, after which it disappears from both views with no tag deletion | |
| and no per-view cleanup. | |
| Keys are TrackRecord tag categories (``genre``, ``instrument``, ``vocal``, | |
| ``mood``, ``theme``); values are the active tag sources in seed priority order | |
| (first entry is the primary source for GT Review). A category absent from the | |
| registry is left unfiltered, so unlisted categories preserve prior behavior. | |
| This is UI/display-facing and intentionally separate from | |
| ``taxonomy/source_policy.py``, which is the prompt-facing evidence trust policy. | |
| """ | |
| from __future__ import annotations | |
| ACTIVE_INFER_SOURCES: dict[str, list[str]] = { | |
| "genre": ["genre-fusion-v1", "muq-probe-v1", "taxonomy-adapter-v1", "maest"], | |
| "instrument": [ | |
| # CLAP-on-stem detections (demucs): rich folk-instrument vocab + real | |
| # confidence — preferred when present (live demucs path), else the probes. | |
| "stem-window-v1", | |
| "muq-probe-v1", | |
| "taxonomy-adapter-v1", | |
| # Expanded-GT probes carry instrument coverage on tracks that lack a | |
| # canonical muq-probe-v1/adapter instrument tag (e.g. 038_dert_olur). | |
| "muq-probe-expanded-v1", | |
| "passt-probe-expanded-v1", | |
| ], | |
| # autoresearch promotion (2026-06-23): taxonomy-adapter-v1 first — its | |
| # vocal_configuration heads score f1 0.778 vs muq-probe-v1's ~0.12 on the 16 | |
| # reviewed Median GT tracks (the champion vocal win). muq-probe-v1 stays as a | |
| # fallback for tracks the adapter leaves untagged. | |
| "vocal": ["taxonomy-adapter-v1", "muq-probe-v1"], | |
| # autoresearch promotion (2026-06-22): lyla-text-clf first — it scores mood | |
| # f1 0.731 vs mood-fusion-v0's 0.629 on the 16 reviewed Median GT tracks. lyla | |
| # is lyric-only, so when a track has no lyrics _pick_tags falls through to the | |
| # audio+lyric fusion automatically (sensible fallback). | |
| "mood": ["lyla-text-clf", "mood-fusion-v0"], | |
| # autoresearch promotion (2026-06-23): theme-fusion-v0 first — it unions the | |
| # high-precision lyrics-llm themes with lyla recall recovery (score>=0.45), | |
| # scoring f1 0.732 vs lyrics-llm's 0.591 on the 16 reviewed Median GT tracks. | |
| "theme": ["theme-fusion-v0", "lyrics-llm", "lyla-text-clf"], | |
| } | |
| def active_sources(category: str) -> list[str] | None: | |
| """Active sources for a category in seed-priority order, or ``None`` when | |
| the category is not registered (callers should then apply no filtering).""" | |
| return ACTIVE_INFER_SOURCES.get(category) | |
| def is_active(category: str, source: str | None) -> bool: | |
| """Whether ``source`` is active for ``category``. Unregistered categories | |
| return ``True`` so unlisted categories are not silently hidden.""" | |
| allowed = ACTIVE_INFER_SOURCES.get(category) | |
| if allowed is None: | |
| return True | |
| return source in allowed | |