Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -21,7 +21,16 @@ def inference(audio_file: str, model_name: str, vocals: bool, drums: bool, bass:
|
|
21 |
|
22 |
yield None, stream_log("Starting separation process...")
|
23 |
yield None, stream_log(f"Loading audio file: {audio_file}")
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
ref = wav.mean(0)
|
26 |
wav = (wav - ref.view(1, -1)).to(device)
|
27 |
yield None, stream_log("Audio loaded successfully. Applying model...")
|
|
|
21 |
|
22 |
yield None, stream_log("Starting separation process...")
|
23 |
yield None, stream_log(f"Loading audio file: {audio_file}")
|
24 |
+
|
25 |
+
# Load the audio file without specifying channels
|
26 |
+
wav = load_track(audio_file, separator.samplerate)
|
27 |
+
|
28 |
+
# Check the number of channels and adjust if necessary
|
29 |
+
if wav.shape[0] == 1:
|
30 |
+
wav = wav.repeat(2, 1) # If mono, duplicate to stereo
|
31 |
+
elif wav.shape[0] > 2:
|
32 |
+
wav = wav[:2] # If more than 2 channels, keep only the first two
|
33 |
+
|
34 |
ref = wav.mean(0)
|
35 |
wav = (wav - ref.view(1, -1)).to(device)
|
36 |
yield None, stream_log("Audio loaded successfully. Applying model...")
|