Spaces:
Runtime error
Runtime error
Ahsen Khaliq
commited on
Commit
·
0be0c2f
1
Parent(s):
156bcbf
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,27 +1,26 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import os
|
| 3 |
-
from pathlib import Path
|
| 4 |
from scipy.io.wavfile import write
|
| 5 |
|
| 6 |
-
|
| 7 |
def inference(audio):
|
| 8 |
os.makedirs("out", exist_ok=True)
|
| 9 |
-
#oldext = os.path.splitext(audio)[1]
|
| 10 |
-
#os.rename(audio.name, "audio" + oldext)
|
| 11 |
write('test.wav', audio[0], audio[1])
|
| 12 |
os.system("python3 -m demucs.separate -n demucs48_hq -d cpu test.wav -o out")
|
| 13 |
-
|
| 14 |
-
|
| 15 |
|
| 16 |
-
title = "
|
| 17 |
-
description = "demo for
|
| 18 |
-
article = "<p style='text-align: center'><a href='https://arxiv.org/abs/
|
| 19 |
|
|
|
|
| 20 |
gr.Interface(
|
| 21 |
inference,
|
| 22 |
[gr.inputs.Audio(type="numpy", label="Input")],
|
| 23 |
-
gr.outputs.Audio(type="file", label="
|
| 24 |
title=title,
|
| 25 |
description=description,
|
| 26 |
-
article=article
|
|
|
|
|
|
|
| 27 |
).launch(debug=True)
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import os
|
|
|
|
| 3 |
from scipy.io.wavfile import write
|
| 4 |
|
|
|
|
| 5 |
def inference(audio):
|
| 6 |
os.makedirs("out", exist_ok=True)
|
|
|
|
|
|
|
| 7 |
write('test.wav', audio[0], audio[1])
|
| 8 |
os.system("python3 -m demucs.separate -n demucs48_hq -d cpu test.wav -o out")
|
| 9 |
+
return "./out/demucs48_hq/test/vocals.wav","./out/demucs48_hq/test/bass.wav",
|
| 10 |
+
"./out/demucs48_hq/test/drums.wav","./out/demucs48_hq/test/other.wav"
|
| 11 |
|
| 12 |
+
title = "Demucs"
|
| 13 |
+
description = "Gradio demo for Demucs: Music Source Separation in the Waveform Domain. To use it, simply upload your audio, or click one of the examples to load them. Read more at the links below."
|
| 14 |
+
article = "<p style='text-align: center'><a href='https://arxiv.org/abs/1911.13254'>Music Source Separation in the Waveform Domain</a> | <a href='https://github.com/facebookresearch/demucs'>Github Repo</a></p>"
|
| 15 |
|
| 16 |
+
examples=['test.mp3']
|
| 17 |
gr.Interface(
|
| 18 |
inference,
|
| 19 |
[gr.inputs.Audio(type="numpy", label="Input")],
|
| 20 |
+
[gr.outputs.Audio(type="file", label="Vocals"),gr.outputs.Audio(type="file", label="Bass"),gr.outputs.Audio(type="file", label="Drums"),gr.outputs.Audio(type="file", label="Other")],
|
| 21 |
title=title,
|
| 22 |
description=description,
|
| 23 |
+
article=article,
|
| 24 |
+
examples=examples,
|
| 25 |
+
enable_queue=True
|
| 26 |
).launch(debug=True)
|