Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -22,14 +22,11 @@ def inference(audio_file: str, model_name: str, vocals: bool, drums: bool, bass:
|
|
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 with the correct
|
26 |
-
wav
|
27 |
|
28 |
-
#
|
29 |
-
|
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)
|
|
|
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 with the correct parameters
|
26 |
+
wav = load_track(audio_file, device, audio_channels=2, samplerate=separator.samplerate)
|
27 |
|
28 |
+
# The load_track function already handles channel conversion and resampling,
|
29 |
+
# so we can remove the channel adjustment code here.
|
|
|
|
|
|
|
30 |
|
31 |
ref = wav.mean(0)
|
32 |
wav = (wav - ref.view(1, -1)).to(device)
|