import streamlit as st import streamlit_pianoroll from fortepyan import MidiPiece from datasets import load_dataset def main(): dataset = load_dataset("epr-labs/pijamia-midi-v1", split="train") record_idx = st.number_input( label="record id", min_value=0, max_value=len(dataset) - 1, value=0, ) record = dataset[record_idx] piece = MidiPiece.from_huggingface(record) # TODO Improve fortepyan to make this cleaner piece.time_shift(-piece.df.start.min()) streamlit_pianoroll.from_fortepyan(piece) st.write("#### Piece metadata") st.json(piece.source) if __name__ == "__main__": main()