Upload 3 files
Browse files- app.py +28 -0
- packages.txt +1 -0
- requirements.txt +2 -0
app.py
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 htdemucs_ft test.wav -o out")
|
9 |
+
return "./out/htdemucs_ft/test/vocals.wav","./out/htdemucs_ft/test/bass.wav",\
|
10 |
+
"./out/htdemucs_ft/test/drums.wav","./out/htdemucs_ft/test/other.wav"
|
11 |
+
|
12 |
+
title = "Demucs"
|
13 |
+
description = "Demucs: Music Source Separation"
|
14 |
+
article = "<p style='text-align: center'><a href='' target='_blank'></a> | <a href='https://github.com/facebookresearch/demucs' target='_blank'>Github</a></p>"
|
15 |
+
|
16 |
+
examples=[['test.mp3']]
|
17 |
+
|
18 |
+
iface = gr.Interface(
|
19 |
+
inference,
|
20 |
+
gr.inputs.Audio(type="numpy", label="Input"),
|
21 |
+
[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")],
|
22 |
+
title=title,
|
23 |
+
description=description,
|
24 |
+
article=article,
|
25 |
+
examples=examples
|
26 |
+
)
|
27 |
+
|
28 |
+
iface.launch(enable_queue=True)
|
packages.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
ffmpeg
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
demucs
|
2 |
+
scipy
|