Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,9 +1,12 @@
|
|
1 |
import streamlit as st
|
2 |
import os
|
3 |
-
import time
|
4 |
import tempfile
|
5 |
import subprocess
|
6 |
|
|
|
|
|
|
|
|
|
7 |
def separate_audio(audio_path):
|
8 |
|
9 |
print(f"{audio_path=}")
|
@@ -103,20 +106,26 @@ def separate_audio_by_stem(audio_path, stem_count):
|
|
103 |
{'description': 'Other', 'path':other_path},
|
104 |
]
|
105 |
|
|
|
|
|
106 |
|
107 |
uploaded_file = st.file_uploader("Choose a file", type=["wav","mp3"])
|
108 |
-
selected_stem_count = st.radio("
|
109 |
|
110 |
if uploaded_file is not None:
|
111 |
|
112 |
if st.button("Submit"):
|
113 |
|
|
|
114 |
with tempfile.NamedTemporaryFile(delete=False) as temp_file:
|
115 |
temp_file.write(uploaded_file.read())
|
116 |
temp_file_path = temp_file.name
|
117 |
-
|
118 |
-
separate_audios = separate_audio_by_stem(temp_file_path, selected_stem_count)
|
119 |
|
|
|
|
|
|
|
|
|
|
|
120 |
for audio in separate_audios:
|
121 |
st.write(audio['description'])
|
122 |
st.audio(audio['path'], format="audio/wav", start_time=0)
|
|
|
1 |
import streamlit as st
|
2 |
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 |
{'description': 'Other', 'path':other_path},
|
107 |
]
|
108 |
|
109 |
+
# Streamlit app content
|
110 |
+
st.write("Upload an audio file")
|
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 |
if st.button("Submit"):
|
118 |
|
119 |
+
# Save the uploaded file to a temporary location
|
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 |
+
# Process the uploaded audio file
|
125 |
+
separate_audios = separate_audio_by_stem(temp_file_path, selected_stem_count)
|
126 |
+
|
127 |
+
# Display the output files for download
|
128 |
+
st.write("Output Files:")
|
129 |
for audio in separate_audios:
|
130 |
st.write(audio['description'])
|
131 |
st.audio(audio['path'], format="audio/wav", start_time=0)
|