Spaces:
Sleeping
Sleeping
Show a please wait message when caching datasets
Browse files
app.py
CHANGED
@@ -2,7 +2,7 @@ import streamlit as st
|
|
2 |
import streamlit_pianoroll
|
3 |
from fortepyan import MidiPiece
|
4 |
|
5 |
-
from datasets import load_dataset
|
6 |
|
7 |
|
8 |
def main():
|
@@ -12,6 +12,7 @@ def main():
|
|
12 |
"giant-midi-sustain-v2",
|
13 |
"maestro-sustain-v2",
|
14 |
"imslp-midi-v1",
|
|
|
15 |
]
|
16 |
dataset_name = st.selectbox(
|
17 |
label="Select dataset",
|
@@ -20,10 +21,17 @@ def main():
|
|
20 |
preview_dataset(dataset_name)
|
21 |
|
22 |
|
23 |
-
|
|
|
24 |
dataset = load_dataset(f"epr-labs/{dataset_name}", split="train")
|
25 |
|
|
|
|
|
|
|
|
|
26 |
st.write(f"### Dataset: {dataset_name}")
|
|
|
|
|
27 |
|
28 |
st.write(f"""
|
29 |
Number of records: {len(dataset)}
|
|
|
2 |
import streamlit_pianoroll
|
3 |
from fortepyan import MidiPiece
|
4 |
|
5 |
+
from datasets import load_dataset, Dataset
|
6 |
|
7 |
|
8 |
def main():
|
|
|
12 |
"giant-midi-sustain-v2",
|
13 |
"maestro-sustain-v2",
|
14 |
"imslp-midi-v1",
|
15 |
+
"atepp-1.1-sustain-v2",
|
16 |
]
|
17 |
dataset_name = st.selectbox(
|
18 |
label="Select dataset",
|
|
|
21 |
preview_dataset(dataset_name)
|
22 |
|
23 |
|
24 |
+
@st.cache_data(persist="disk")
|
25 |
+
def get_dataset(dataset_name: str) -> Dataset:
|
26 |
dataset = load_dataset(f"epr-labs/{dataset_name}", split="train")
|
27 |
|
28 |
+
return dataset
|
29 |
+
|
30 |
+
|
31 |
+
def preview_dataset(dataset_name: str):
|
32 |
st.write(f"### Dataset: {dataset_name}")
|
33 |
+
with st.spinner("Loading the dataset, hang tight!"):
|
34 |
+
dataset = get_dataset(dataset_name)
|
35 |
|
36 |
st.write(f"""
|
37 |
Number of records: {len(dataset)}
|