Eddycrack864
commited on
Commit
•
9b96687
1
Parent(s):
a8484c0
Update app.py
Browse files
app.py
CHANGED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
from scipy.io.wavfile import write
|
3 |
+
import gradio as Gradio
|
4 |
+
|
5 |
+
def separator(audio):
|
6 |
+
os.makedirs("output", exist_ok=True)
|
7 |
+
write('test.wav', audio[0], audio[1])
|
8 |
+
result = os.system("audio-separator test.wav --model_filename model_bs_roformer_ep_317_sdr_12.9755.ckpt --output_dir=./output --output_format=wav")
|
9 |
+
|
10 |
+
files = [
|
11 |
+
"./output/test_(Instrumental)_model_bs_roformer_ep_317_sdr_12.wav",
|
12 |
+
"./output/test_(Vocals)_model_bs_roformer_ep_317_sdr_12.wav"
|
13 |
+
]
|
14 |
+
|
15 |
+
for file in files:
|
16 |
+
if not os.path.isfile(file):
|
17 |
+
print(f"File not found: {file}")
|
18 |
+
else:
|
19 |
+
print(f"File exists: {file}")
|
20 |
+
|
21 |
+
return files;
|
22 |
+
|
23 |
+
Gradio.Interface(
|
24 |
+
separator,
|
25 |
+
Gradio.Audio(type="numpy", label="Input"),
|
26 |
+
[Gradio.Audio(type="filepath", label="Stem 1", interactive=False),
|
27 |
+
Gradio.Audio(type="filepath", label="Stem 2", interactive=False)]
|
28 |
+
).launch()
|