Spaces:
Running
Running
| mport os | |
| import gradio as gr | |
| from scipy.io.wavfile import write | |
| def extract_vocals(audio): | |
| if audio is None: | |
| return None | |
| os.makedirs("out", exist_ok=True) | |
| rate, data = audio | |
| write("input.wav", rate, data) | |
| os.system("python3 -m demucs.separate -n htdemucs --two-stems=vocals -d cpu input.wav -o out") | |
| return "out/htdemucs/input/vocals.wav" | |
| app = gr.Interface( | |
| fn=extract_vocals, | |
| inputs=gr.Audio(type="numpy", label="Upload audio"), | |
| outputs=gr.Audio(type="filepath", label="Extracted Vocals"), | |
| title="Fix My Recording – Vocal Cleaner", | |
| description="Isolate vocals from music using Demucs. Powered by htdemucs." | |
| ) |