File size: 926 Bytes
6134446
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import os
import gradio as gr
from scipy.io.wavfile import write


def inference(audio):
  os.makedirs("out", exist_ok=True)
  write('test.wav', audio[0], audio[1])
  os.system("python3 -m demucs.separate -n mdx_extra -d cpu test.wav -o out")
  return "./out/mdx_extra_q/vocals.wav","./out/mdx_extra_q/bass.wav",\
"./out/mdx_extra_q/drums.wav","./out/mdx_extra_q/other.wav"
  
title = "Sound Extraction"
description = "Gradio demo for sound extraction: Music Source Separation in the Waveform Domain. To use it, simply upload your audio."

# examples=[['test.mp3']]
gr.Interface(
    inference, 
    gr.inputs.Audio(type="numpy", label="Input"), 
    [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")],
    title=title,
    description=description
    ).launch(enable_queue=True)