Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -4,22 +4,22 @@ from model import *
|
|
4 |
st.header("Any songs to Lo-Fi")
|
5 |
x = st.file_uploader("Upload your music")
|
6 |
|
7 |
-
|
8 |
-
wv, sr = librosa.load(x, sr=16000) #Load waveform
|
9 |
-
print(wv.shape)
|
10 |
-
speca = prep(wv) #Waveform to Spectrogram
|
11 |
-
|
12 |
-
plt.figure(figsize=(50,1)) #Show Spectrogram
|
13 |
-
plt.imshow(np.flip(speca, axis=0), cmap=None)
|
14 |
-
plt.axis('off')
|
15 |
-
plt.show()
|
16 |
-
|
17 |
-
abwv = towave(speca, name='FILENAME2', path='songs_gen') #Convert and save wav
|
18 |
-
|
19 |
-
with open("AB.wav", "rb") as file:
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
|
|
4 |
st.header("Any songs to Lo-Fi")
|
5 |
x = st.file_uploader("Upload your music")
|
6 |
|
7 |
+
if uploaded_file is not None:
|
8 |
+
wv, sr = librosa.load(x, sr=16000) #Load waveform
|
9 |
+
print(wv.shape)
|
10 |
+
speca = prep(wv) #Waveform to Spectrogram
|
11 |
+
|
12 |
+
plt.figure(figsize=(50,1)) #Show Spectrogram
|
13 |
+
plt.imshow(np.flip(speca, axis=0), cmap=None)
|
14 |
+
plt.axis('off')
|
15 |
+
plt.show()
|
16 |
+
|
17 |
+
abwv = towave(speca, name='FILENAME2', path='songs_gen') #Convert and save wav
|
18 |
+
|
19 |
+
with open("AB.wav", "rb") as file:
|
20 |
+
btn = st.download_button(
|
21 |
+
label="Download image",
|
22 |
+
data=file,
|
23 |
+
file_name="AB.wav",
|
24 |
+
mime="image/png"
|
25 |
+
)
|