Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,10 +3,6 @@ import os
|
|
| 3 |
import tempfile
|
| 4 |
import subprocess
|
| 5 |
|
| 6 |
-
# Set Streamlit app title
|
| 7 |
-
st.title("Audio Separation App")
|
| 8 |
-
|
| 9 |
-
# Function to process the audio file
|
| 10 |
def separate_audio(audio_path):
|
| 11 |
|
| 12 |
print(f"{audio_path=}")
|
|
@@ -106,26 +102,18 @@ def separate_audio_by_stem(audio_path, stem_count):
|
|
| 106 |
{'description': 'Other', 'path':other_path},
|
| 107 |
]
|
| 108 |
|
| 109 |
-
|
| 110 |
-
st.
|
| 111 |
-
|
| 112 |
-
uploaded_file = st.file_uploader("Choose a file", type=["wav","mp3"])
|
| 113 |
-
selected_stem_count = st.radio("Select stem count", (2,4,5))
|
| 114 |
|
| 115 |
if uploaded_file is not None:
|
| 116 |
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
with tempfile.NamedTemporaryFile(delete=False) as temp_file:
|
| 121 |
-
temp_file.write(uploaded_file.read())
|
| 122 |
-
temp_file_path = temp_file.name
|
| 123 |
|
| 124 |
-
|
| 125 |
-
separate_audios = separate_audio_by_stem(temp_file_path, selected_stem_count)
|
| 126 |
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
st.audio(audio['path'], format="audio/wav", start_time=0)
|
|
|
|
| 3 |
import tempfile
|
| 4 |
import subprocess
|
| 5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
def separate_audio(audio_path):
|
| 7 |
|
| 8 |
print(f"{audio_path=}")
|
|
|
|
| 102 |
{'description': 'Other', 'path':other_path},
|
| 103 |
]
|
| 104 |
|
| 105 |
+
uploaded_file = st.file_uploader("", type=["wav","mp3"])
|
| 106 |
+
selected_stem_count = st.radio("Stem count", (2,4,5))
|
|
|
|
|
|
|
|
|
|
| 107 |
|
| 108 |
if uploaded_file is not None:
|
| 109 |
|
| 110 |
+
with tempfile.NamedTemporaryFile(delete=False) as temp_file:
|
| 111 |
+
temp_file.write(uploaded_file.read())
|
| 112 |
+
temp_file_path = temp_file.name
|
|
|
|
|
|
|
|
|
|
| 113 |
|
| 114 |
+
separate_audios = separate_audio_by_stem(temp_file_path, selected_stem_count)
|
|
|
|
| 115 |
|
| 116 |
+
st.write("Output Files:")
|
| 117 |
+
for audio in separate_audios:
|
| 118 |
+
st.write(audio['description'])
|
| 119 |
+
st.audio(audio['path'], format="audio/wav", start_time=0)
|
|
|