Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -22,22 +22,25 @@ def separate_audio(audio_path, stem_count):
|
|
| 22 |
randomnumber = str(random.randint(111111111, 999999999))
|
| 23 |
paths = []
|
| 24 |
if stem_count == 2:
|
| 25 |
-
paths.append(
|
| 26 |
-
paths.append(
|
| 27 |
elif stem_count == 4 or stem_count == 5:
|
| 28 |
-
paths.append(
|
| 29 |
-
paths.append(
|
| 30 |
-
paths.append(
|
| 31 |
-
paths.append(
|
| 32 |
if stem_count == 5:
|
| 33 |
-
paths.append(
|
| 34 |
|
| 35 |
-
|
|
|
|
| 36 |
|
|
|
|
| 37 |
iface = gr.Interface(
|
| 38 |
fn=separate_audio,
|
| 39 |
inputs=[gr.Audio(type="filepath"), gr.Radio([2, 4, 5])],
|
| 40 |
-
outputs=
|
| 41 |
)
|
| 42 |
|
|
|
|
| 43 |
iface.launch()
|
|
|
|
| 22 |
randomnumber = str(random.randint(111111111, 999999999))
|
| 23 |
paths = []
|
| 24 |
if stem_count == 2:
|
| 25 |
+
paths.append(gradio_temp_path + f"/separated_audio/{randomnumber}/accompaniment.wav")
|
| 26 |
+
paths.append(gradio_temp_path + f"/separated_audio/{randomnumber}/vocals.wav")
|
| 27 |
elif stem_count == 4 or stem_count == 5:
|
| 28 |
+
paths.append(gradio_temp_path + f"/separated_audio/{randomnumber}/vocals.wav")
|
| 29 |
+
paths.append(gradio_temp_path + f"/separated_audio/{randomnumber}/drums.wav")
|
| 30 |
+
paths.append(gradio_temp_path + f"/separated_audio/{randomnumber}/bass.wav")
|
| 31 |
+
paths.append(gradio_temp_path + f"/separated_audio/{randomnumber}/other.wav")
|
| 32 |
if stem_count == 5:
|
| 33 |
+
paths.append(gradio_temp_path + f"/separated_audio/{randomnumber}/piano.wav")
|
| 34 |
|
| 35 |
+
# Return the audio file paths as a list of Audio components
|
| 36 |
+
return [gr.Audio(file_path=path) for path in paths]
|
| 37 |
|
| 38 |
+
# Define the Gradio interface
|
| 39 |
iface = gr.Interface(
|
| 40 |
fn=separate_audio,
|
| 41 |
inputs=[gr.Audio(type="filepath"), gr.Radio([2, 4, 5])],
|
| 42 |
+
outputs=[gr.Audio(label='Accompaniment'), gr.Audio(label='Vocals'), gr.Audio(label='Drums'), gr.Audio(label='Bass'), gr.Audio(label='Other'), gr.Audio(label='Piano')]
|
| 43 |
)
|
| 44 |
|
| 45 |
+
# Launch the interface
|
| 46 |
iface.launch()
|