tee342 commited on
Commit
c108159
·
verified ·
1 Parent(s): 900bbf4
Files changed (1) hide show
  1. app.py +20 -0
app.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ mport os
2
+ import gradio as gr
3
+ from scipy.io.wavfile import write
4
+
5
+ def extract_vocals(audio):
6
+ if audio is None:
7
+ return None
8
+ os.makedirs("out", exist_ok=True)
9
+ rate, data = audio
10
+ write("input.wav", rate, data)
11
+ os.system("python3 -m demucs.separate -n htdemucs --two-stems=vocals -d cpu input.wav -o out")
12
+ return "out/htdemucs/input/vocals.wav"
13
+
14
+ app = gr.Interface(
15
+ fn=extract_vocals,
16
+ inputs=gr.Audio(type="numpy", label="Upload audio"),
17
+ outputs=gr.Audio(type="filepath", label="Extracted Vocals"),
18
+ title="Fix My Recording – Vocal Cleaner",
19
+ description="Isolate vocals from music using Demucs. Powered by htdemucs."
20
+ )