audiosep / fn.py
aka7774's picture
Upload 6 files
c7f5530 verified
raw history blame
No virus
630 Bytes
import os
import tempfile
from audio_separator.separator import Separator
separator = None
def load_model():
global separator
separator = Separator()
separator.load_model('Kim_Vocal_2.onnx')
def run(audio_path):
global separator
if not audio_path:
return None, None
primary_stem_output_path, secondary_stem_output_path = separator.separate(audio_path)
return primary_stem_output_path, secondary_stem_output_path
def raw(audio):
with tempfile.NamedTemporaryFile(delete=True) as t:
with open(t.name, 'w+b') as f:
f.write(audio)
return run(t.name)