roszcz commited on
Commit
aef5d66
1 Parent(s): 185b013
Files changed (3) hide show
  1. README.md +1 -1
  2. app.py +2 -51
  3. app_v2.py +0 -5
README.md CHANGED
@@ -5,7 +5,7 @@ colorFrom: purple
5
  colorTo: indigo
6
  sdk: streamlit
7
  sdk_version: 1.39.0
8
- app_file: app_v2.py
9
  pinned: false
10
  license: mit
11
  short_description: Demo of masking tasks from the PIANO dataset
 
5
  colorTo: indigo
6
  sdk: streamlit
7
  sdk_version: 1.39.0
8
+ app_file: app.py
9
  pinned: false
10
  license: mit
11
  short_description: Demo of masking tasks from the PIANO dataset
app.py CHANGED
@@ -1,54 +1,5 @@
1
- import streamlit as st
2
- import streamlit_pianoroll
3
- from datasets import load_dataset
4
- from piano_dataset import PianoTasks
5
- from fortepyan import MidiPiece
6
-
7
-
8
- def main():
9
- st.write("# PIANO dataset task review")
10
-
11
- available_tasks = PianoTasks.list_tasks()
12
- task_name = st.selectbox(
13
- label="Select PIANO task",
14
- options=available_tasks,
15
- )
16
- piano_task = PianoTasks.get_task(task_name=task_name)
17
-
18
- dataset = load_dataset("epr-labs/maestro-sustain-v2", split="test+validation")
19
- record_idx = st.number_input(
20
- label="Record ID",
21
- min_value=0,
22
- max_value=len(dataset) - 1,
23
- value=43,
24
- )
25
-
26
- record = dataset[record_idx]
27
- piece = MidiPiece.from_huggingface(record)
28
- piece.time_shift(-piece.df.start.min())
29
-
30
- st.json(piece.source)
31
-
32
- piece_split = piano_task.prompt_target_split(piece.df)
33
-
34
- source_piece = MidiPiece(df=piece_split.source_df)
35
- target_piece = MidiPiece(df=piece_split.target_df)
36
-
37
- cols = st.columns(2)
38
- with cols[0]:
39
- st.write("## Prompt")
40
- streamlit_pianoroll.from_fortepyan(source_piece)
41
-
42
- with cols[1]:
43
- st.write("## Target")
44
- streamlit_pianoroll.from_fortepyan(target_piece)
45
-
46
- st.write("## Combined")
47
- streamlit_pianoroll.from_fortepyan(
48
- piece=source_piece,
49
- secondary_piece=target_piece,
50
- )
51
 
52
 
53
  if __name__ == "__main__":
54
- main()
 
1
+ from piano_dataset.dashboards import task_review
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
 
4
  if __name__ == "__main__":
5
+ task_review.main()
app_v2.py DELETED
@@ -1,5 +0,0 @@
1
- from piano_dataset.dashboards import task_review
2
-
3
-
4
- if __name__ == "__main__":
5
- task_review.main()