Spaces:
Sleeping
Sleeping
Download sim/notation_component.py from adisha-education-lab/Mus_Sim_1-beta: direct link, hf CLI and curl.
- Browser
- Download file 538 Bytes
-
https://huggingface.co/spaces/adisha-education-lab/Mus_Sim_1-beta/resolve/main/sim/notation_component.py
- Command line
-
hf download hf://spaces/adisha-education-lab/Mus_Sim_1-beta/sim/notation_component.py
-
curl -L -o notation_component.py https://huggingface.co/spaces/adisha-education-lab/Mus_Sim_1-beta/resolve/main/sim/notation_component.py
538 Bytes
| from __future__ import annotations | |
| import streamlit.components.v1 as components | |
| from sim.notation_svg import grand_staff_svg | |
| def notation_staff(chord_midi, prefer_sharps: bool = True): | |
| """ | |
| Offline notation renderer (no CDN). | |
| Generates an SVG grand staff for the chord and embeds it via components.html. | |
| """ | |
| svg = grand_staff_svg(list(chord_midi), prefer_sharps=prefer_sharps) | |
| nonce = "_".join(str(int(x)) for x in chord_midi) | |
| components.html(svg + f"<!-- vf_offline_{nonce} -->", height=270, scrolling=False) | |