File size: 846 Bytes
9b96687
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import os
from scipy.io.wavfile import write
import gradio as Gradio

def separator(audio):
	os.makedirs("output", exist_ok=True)
	write('test.wav', audio[0], audio[1])
	result = os.system("audio-separator test.wav --model_filename model_bs_roformer_ep_317_sdr_12.9755.ckpt --output_dir=./output --output_format=wav")

	files = [
    "./output/test_(Instrumental)_model_bs_roformer_ep_317_sdr_12.wav",
	"./output/test_(Vocals)_model_bs_roformer_ep_317_sdr_12.wav"
  ]

	for file in files:
		if not os.path.isfile(file):
			print(f"File not found: {file}")
		else:
			print(f"File exists: {file}")

	return files;

Gradio.Interface(
    separator,
    Gradio.Audio(type="numpy", label="Input"),
    [Gradio.Audio(type="filepath", label="Stem 1", interactive=False),
     Gradio.Audio(type="filepath", label="Stem 2", interactive=False)]
).launch()