Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -7,8 +7,9 @@ import subprocess
|
|
7 |
from pydub import AudioSegment
|
8 |
from typing import Tuple, Dict, List
|
9 |
from demucs.apply import apply_model
|
10 |
-
from demucs.separate import load_track
|
11 |
from demucs.pretrained import get_model
|
|
|
12 |
|
13 |
# check if cuda is available
|
14 |
device: str = "cuda" if torch.cuda.is_available() else "cpu"
|
@@ -70,7 +71,7 @@ def inference(audio_file: str, model_name: str, vocals: bool, drums: bool, bass:
|
|
70 |
for stem, source in zip(separator.sources, sources):
|
71 |
stem_path: str = os.path.join(output_dir, f"{stem}.wav")
|
72 |
# demucs.api.save_audio(source, stem_path, samplerate=separator.samplerate)
|
73 |
-
|
74 |
stems[stem] = stem_path
|
75 |
|
76 |
# mix the selected stems
|
|
|
7 |
from pydub import AudioSegment
|
8 |
from typing import Tuple, Dict, List
|
9 |
from demucs.apply import apply_model
|
10 |
+
from demucs.separate import load_track
|
11 |
from demucs.pretrained import get_model
|
12 |
+
from demucs.audio import save_audio # Import save_audio from demucs.audio
|
13 |
|
14 |
# check if cuda is available
|
15 |
device: str = "cuda" if torch.cuda.is_available() else "cpu"
|
|
|
71 |
for stem, source in zip(separator.sources, sources):
|
72 |
stem_path: str = os.path.join(output_dir, f"{stem}.wav")
|
73 |
# demucs.api.save_audio(source, stem_path, samplerate=separator.samplerate)
|
74 |
+
save_audio(source, stem_path, separator.samplerate) # Use save_audio
|
75 |
stems[stem] = stem_path
|
76 |
|
77 |
# mix the selected stems
|