Spaces:
Sleeping
Sleeping
Fabio Grasso
commited on
Commit
β’
334bc59
1
Parent(s):
311dc33
fix: reduce examples
Browse files- app/examples.py +8 -8
- app/helpers.py +2 -2
- samples/{push-coma-media.mp3 β broke-me-fassounds.mp3} +2 -2
- samples/{push-coma-media β broke-me-fassounds}/bass.mp3 +2 -2
- samples/{push-coma-media β broke-me-fassounds}/drums.mp3 +2 -2
- samples/{push-coma-media β broke-me-fassounds}/other.mp3 +2 -2
- samples/{push-coma-media β broke-me-fassounds}/vocals.mp3 +2 -2
- samples/indie-rock.mp3 +2 -2
- samples/indie-rock/bass.mp3 +2 -2
- samples/indie-rock/drums.mp3 +2 -2
- samples/indie-rock/other.mp3 +2 -2
- samples/indie-rock/vocals.mp3 +2 -2
- samples/something-about-you-marilyn-ford.mp3 +2 -2
- samples/something-about-you-marilyn-ford/bass.mp3 +2 -2
- samples/something-about-you-marilyn-ford/drums.mp3 +2 -2
- samples/something-about-you-marilyn-ford/other.mp3 +2 -2
- samples/something-about-you-marilyn-ford/vocals.mp3 +2 -2
app/examples.py
CHANGED
@@ -8,7 +8,7 @@ def _load_example(name: str):
|
|
8 |
cols = st.columns(2)
|
9 |
with cols[0]:
|
10 |
auseg = load_audio_segment(f"samples/{name}", "mp3")
|
11 |
-
plot_audio(auseg)
|
12 |
with cols[1]:
|
13 |
audio_file = open(f"samples/{name}", "rb")
|
14 |
audio_bytes = audio_file.read()
|
@@ -28,7 +28,7 @@ def _load_example(name: str):
|
|
28 |
cols = st.columns(2)
|
29 |
with cols[0]:
|
30 |
auseg = load_audio_segment(f"samples/{name.split('.mp3')[0]}/{file}", "mp3")
|
31 |
-
plot_audio(auseg)
|
32 |
with cols[1]:
|
33 |
audio_file = open(f"samples/{name.split('.mp3')[0]}/{file}", "rb")
|
34 |
audio_bytes = audio_file.read()
|
@@ -37,18 +37,18 @@ def _load_example(name: str):
|
|
37 |
|
38 |
def show_examples():
|
39 |
with st.columns([2, 8, 1])[1]:
|
40 |
-
selection = st.selectbox("Select an example music to quickly see results", ["
|
41 |
-
if selection == "
|
42 |
-
_load_example("
|
43 |
-
link = "https://pixabay.com/users/
|
44 |
st.markdown(
|
45 |
-
f"""Music by <a href="{link}">
|
46 |
unsafe_allow_html=True)
|
47 |
elif selection == "Indie Rock":
|
48 |
_load_example("indie-rock.mp3")
|
49 |
link = "https://pixabay.com/music/indie-rock-112771/"
|
50 |
st.markdown(
|
51 |
-
f"""Music by <a href={link}">Music_Unlimited</a> from <a href="{link}">Pixabay</a>""",
|
52 |
unsafe_allow_html=True)
|
53 |
elif selection == "Something About You - Marilyn Ford":
|
54 |
_load_example("something-about-you-marilyn-ford.mp3")
|
|
|
8 |
cols = st.columns(2)
|
9 |
with cols[0]:
|
10 |
auseg = load_audio_segment(f"samples/{name}", "mp3")
|
11 |
+
plot_audio(auseg, step=50)
|
12 |
with cols[1]:
|
13 |
audio_file = open(f"samples/{name}", "rb")
|
14 |
audio_bytes = audio_file.read()
|
|
|
28 |
cols = st.columns(2)
|
29 |
with cols[0]:
|
30 |
auseg = load_audio_segment(f"samples/{name.split('.mp3')[0]}/{file}", "mp3")
|
31 |
+
plot_audio(auseg, step=50)
|
32 |
with cols[1]:
|
33 |
audio_file = open(f"samples/{name.split('.mp3')[0]}/{file}", "rb")
|
34 |
audio_bytes = audio_file.read()
|
|
|
37 |
|
38 |
def show_examples():
|
39 |
with st.columns([2, 8, 1])[1]:
|
40 |
+
selection = st.selectbox("Select an example music to quickly see results", ["Something About You - Marilyn Ford", "Broke Me - FASSounds", "Indie Rock"])
|
41 |
+
if selection == "Broke Me - FASSounds":
|
42 |
+
_load_example("broke-me-fassounds.mp3")
|
43 |
+
link = "https://pixabay.com/users/fassounds-3433550/"
|
44 |
st.markdown(
|
45 |
+
f"""Music by <a href="{link}">FASSounds</a> from <a href="{link}">Pixabay</a>""",
|
46 |
unsafe_allow_html=True)
|
47 |
elif selection == "Indie Rock":
|
48 |
_load_example("indie-rock.mp3")
|
49 |
link = "https://pixabay.com/music/indie-rock-112771/"
|
50 |
st.markdown(
|
51 |
+
f"""Music by <a href="{link}">Music_Unlimited</a> from <a href="{link}">Pixabay</a>""",
|
52 |
unsafe_allow_html=True)
|
53 |
elif selection == "Something About You - Marilyn Ford":
|
54 |
_load_example("something-about-you-marilyn-ford.mp3")
|
app/helpers.py
CHANGED
@@ -10,9 +10,9 @@ import numpy as np
|
|
10 |
def load_audio_segment(path: str, format: str) -> AudioSegment:
|
11 |
return AudioSegment.from_file(path, format=format)
|
12 |
|
13 |
-
def plot_audio(_audio_segment: AudioSegment, title: str = None) -> go.Figure:
|
14 |
samples = _audio_segment.get_array_of_samples()
|
15 |
-
arr = np.array(samples[::
|
16 |
df = pd.DataFrame(arr)
|
17 |
fig = px.line(df, y=0, render_mode="webgl", line_shape="linear", width=1000, height=60, title=title)
|
18 |
fig.update_layout(xaxis_fixedrange=True, yaxis_fixedrange=True, yaxis_visible=False, xaxis_visible=False, hovermode=False, margin=dict(l=0, r=0, t=0, b=0))
|
|
|
10 |
def load_audio_segment(path: str, format: str) -> AudioSegment:
|
11 |
return AudioSegment.from_file(path, format=format)
|
12 |
|
13 |
+
def plot_audio(_audio_segment: AudioSegment, title: str = None, step = 20) -> go.Figure:
|
14 |
samples = _audio_segment.get_array_of_samples()
|
15 |
+
arr = np.array(samples[::step])
|
16 |
df = pd.DataFrame(arr)
|
17 |
fig = px.line(df, y=0, render_mode="webgl", line_shape="linear", width=1000, height=60, title=title)
|
18 |
fig.update_layout(xaxis_fixedrange=True, yaxis_fixedrange=True, yaxis_visible=False, xaxis_visible=False, hovermode=False, margin=dict(l=0, r=0, t=0, b=0))
|
samples/{push-coma-media.mp3 β broke-me-fassounds.mp3}
RENAMED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8cee8d6d724eec3ae3dc29d7b9581009057da459bf0ab2b1428dc84f532afe4a
|
3 |
+
size 961350
|
samples/{push-coma-media β broke-me-fassounds}/bass.mp3
RENAMED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e2b8f2db0ee38dffbc1ed4a1bb584d7e4e77e9daab9179c75fd51bd5fc10ad47
|
3 |
+
size 1201632
|
samples/{push-coma-media β broke-me-fassounds}/drums.mp3
RENAMED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a6a402c1e95b3bc430e0bd2a0c0d5397e273b86a714eb95194571be261255006
|
3 |
+
size 1201632
|
samples/{push-coma-media β broke-me-fassounds}/other.mp3
RENAMED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a9e96cef31cf77019630ca42345cb1ccd68f1145202ac35353d8ccc33a3bf5b7
|
3 |
+
size 1201632
|
samples/{push-coma-media β broke-me-fassounds}/vocals.mp3
RENAMED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f7e5d2e12b4f6fc41ae44c4bf71fc91cfa591cf670a1f87661d4907737ffd66c
|
3 |
+
size 1201632
|
samples/indie-rock.mp3
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e57a788afacb71dcddc019c61190c99d2ee9722d921ca072033393bea021930c
|
3 |
+
size 1202721
|
samples/indie-rock/bass.mp3
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:519d440101f10b0f23574480b366c5d35ce46b8e5224396197bad894e6690470
|
3 |
+
size 1201632
|
samples/indie-rock/drums.mp3
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:736a94b73cb3d3dc89ce72165d4efd70a8d7c25d6eb432883ea164635dbf1de0
|
3 |
+
size 1201632
|
samples/indie-rock/other.mp3
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d7b82814b2123c9b5014481a68da0579cbe8a37763e48b8fec2532396485f4f4
|
3 |
+
size 1201632
|
samples/indie-rock/vocals.mp3
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c2dc3d8f61972599f3a20fb831c9215e07d81b3e5d2ec76724eb9fc741172985
|
3 |
+
size 1201632
|
samples/something-about-you-marilyn-ford.mp3
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6a05321de34f0d6e325c14e8cb61d083b6969ca6b1735b8178989b74fea3955d
|
3 |
+
size 1202721
|
samples/something-about-you-marilyn-ford/bass.mp3
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3e90eaa19d1496395514c94bf19b3b28caf7da2b314d765536b2e374f2ceb11e
|
3 |
+
size 1201632
|
samples/something-about-you-marilyn-ford/drums.mp3
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:403e55faf8b2e4edf7b188c1d84de5075700b434eb07e5681160f24393dcb89a
|
3 |
+
size 1201632
|
samples/something-about-you-marilyn-ford/other.mp3
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3f9c075e3d6d1cd114c68bf45936a679acde56432557d996cc3984ddd6dd29db
|
3 |
+
size 1201632
|
samples/something-about-you-marilyn-ford/vocals.mp3
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3cbff0465525dbc1cf1ea9c01c57a5f63c76c6a1b53ea6db84fadee67bbc1e6d
|
3 |
+
size 1201632
|