Viking714 commited on
Commit
6134446
1 Parent(s): e0bfd55

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -0
app.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import gradio as gr
3
+ from scipy.io.wavfile import write
4
+
5
+
6
+ def inference(audio):
7
+ os.makedirs("out", exist_ok=True)
8
+ write('test.wav', audio[0], audio[1])
9
+ os.system("python3 -m demucs.separate -n mdx_extra -d cpu test.wav -o out")
10
+ return "./out/mdx_extra_q/vocals.wav","./out/mdx_extra_q/bass.wav",\
11
+ "./out/mdx_extra_q/drums.wav","./out/mdx_extra_q/other.wav"
12
+
13
+ title = "Sound Extraction"
14
+ description = "Gradio demo for sound extraction: Music Source Separation in the Waveform Domain. To use it, simply upload your audio."
15
+
16
+ # examples=[['test.mp3']]
17
+ gr.Interface(
18
+ inference,
19
+ gr.inputs.Audio(type="numpy", label="Input"),
20
+ [gr.outputs.Audio(type="filepath", label="Vocals"),gr.outputs.Audio(type="filepath", label="Bass"),gr.outputs.Audio(type="filepath", label="Drums"),gr.outputs.Audio(type="filepath", label="Other")],
21
+ title=title,
22
+ description=description
23
+ ).launch(enable_queue=True)