Spaces:
Sleeping
Sleeping
Fabio Grasso
commited on
Commit
•
e543ecb
1
Parent(s):
93bb83f
feat: enable demucs separator
Browse files- app/main.py +20 -20
app/main.py
CHANGED
@@ -8,10 +8,10 @@ import streamlit as st
|
|
8 |
|
9 |
# from lib.st_custom_components import st_audiorec
|
10 |
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
|
16 |
|
17 |
logging.basicConfig(
|
@@ -128,22 +128,22 @@ def run():
|
|
128 |
song = song[start_time*1000:end_time*1000]
|
129 |
song.export(in_path / filename, format=filename.split(".")[-1])
|
130 |
with st.spinner(f"Splitting source audio, it will take almost {round(tot_time*3.6)} seconds..."):
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
pass
|
148 |
last_dir = ".".join(filename.split(".")[:-1])
|
149 |
for file in ["vocals.mp3", "drums.mp3", "bass.mp3", "other.mp3"]:
|
|
|
8 |
|
9 |
# from lib.st_custom_components import st_audiorec
|
10 |
|
11 |
+
try:
|
12 |
+
from app.demucs_runner import separator
|
13 |
+
except ImportError:
|
14 |
+
from demucs_runner import separator
|
15 |
|
16 |
|
17 |
logging.basicConfig(
|
|
|
128 |
song = song[start_time*1000:end_time*1000]
|
129 |
song.export(in_path / filename, format=filename.split(".")[-1])
|
130 |
with st.spinner(f"Splitting source audio, it will take almost {round(tot_time*3.6)} seconds..."):
|
131 |
+
separator(
|
132 |
+
tracks=[in_path / filename],
|
133 |
+
out=out_path,
|
134 |
+
model=model,
|
135 |
+
device="cpu",
|
136 |
+
shifts=1,
|
137 |
+
overlap=0.5,
|
138 |
+
stem=two_stems,
|
139 |
+
int24=int24,
|
140 |
+
float32=float32,
|
141 |
+
clip_mode="rescale",
|
142 |
+
mp3=mp3,
|
143 |
+
mp3_bitrate=mp3_rate,
|
144 |
+
jobs=os.cpu_count(),
|
145 |
+
verbose=True,
|
146 |
+
)
|
147 |
pass
|
148 |
last_dir = ".".join(filename.split(".")[:-1])
|
149 |
for file in ["vocals.mp3", "drums.mp3", "bass.mp3", "other.mp3"]:
|