Spaces:
Running
Running
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() |