Spaces:
Sleeping
Sleeping
| # waveform_renderer.py | |
| # Author: Liam Grinstead | |
| # Collapse gradient waveform (safe) | |
| def render_waveform(agent: dict, score: float) -> str: | |
| overlay = agent.get("collapse_overlay", {}) or {} | |
| tau = overlay.get("tau_eff", 1.2) | |
| beta = overlay.get("beta_band", 0.5) | |
| try: | |
| amp = min(40, 12 + float(tau) * 10) | |
| hue = int(20 + float(beta) * 220) | |
| speed = max(1.2, 2.4 - float(beta)) | |
| except Exception: | |
| amp, hue, speed = 18, 140, 2.0 | |
| return f""" | |
| <svg width="420" height="140" xmlns="http://www.w3.org/2000/svg"> | |
| <text x="10" y="24" font-size="16">Collapse Gradient</text> | |
| <path d="M10 80 Q80 {80-amp} 150 80 T290 80 T410 80" | |
| stroke="hsl({hue},80%,50%)" fill="none" stroke-width="3"> | |
| <animate attributeName="stroke" values="hsl({hue},80%,50%);hsl({hue},80%,65%);hsl({hue},80%,50%)" | |
| dur="{speed}s" repeatCount="indefinite"/> | |
| </path> | |
| <text x="10" y="120" font-size="12">τ_eff={tau} · β={beta} · score={score}</text> | |
| </svg> | |
| """ | |