Skip to content

Commit e01c894

Browse files
committed
format
1 parent f36de9b commit e01c894

1 file changed

Lines changed: 5 additions & 13 deletions

File tree

basic_pitch/inference.py

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,7 @@
5252
import librosa
5353
import pretty_midi
5454

55-
from basic_pitch.constants import (
56-
AUDIO_SAMPLE_RATE,
57-
AUDIO_N_SAMPLES,
58-
ANNOTATIONS_FPS,
59-
FFT_HOP,
60-
AUDIO_WINDOW_LENGTH
61-
)
55+
from basic_pitch.constants import AUDIO_SAMPLE_RATE, AUDIO_N_SAMPLES, ANNOTATIONS_FPS, FFT_HOP, AUDIO_WINDOW_LENGTH
6256
from basic_pitch.commandline_printing import (
6357
generating_file_message,
6458
no_tf_warnings,
@@ -245,10 +239,7 @@ def get_audio_input(
245239

246240

247241
def unwrap_output(
248-
output: npt.NDArray[np.float32],
249-
audio_original_length: int,
250-
n_overlapping_frames: int,
251-
hop_size: int
242+
output: npt.NDArray[np.float32], audio_original_length: int, n_overlapping_frames: int, hop_size: int
252243
) -> np.array:
253244
"""Unwrap batched model predictions to a single matrix.
254245
@@ -272,7 +263,7 @@ def unwrap_output(
272263
# Concatenate the frames outputs (overlapping frames removed) into a single dimension
273264
output_shape = output.shape
274265
unwrapped_output = output.reshape(output_shape[0] * output_shape[1], output_shape[2])
275-
266+
276267
# trim to number of expected windows in output
277268
n_expected_windows = audio_original_length / hop_size
278269
n_frames_per_window = (AUDIO_WINDOW_LENGTH * ANNOTATIONS_FPS) - n_overlapping_frames
@@ -310,7 +301,8 @@ def run_inference(
310301
output[k].append(v)
311302

312303
unwrapped_output = {
313-
k: unwrap_output(np.concatenate(output[k]), audio_original_length, n_overlapping_frames, hop_size) for k in output
304+
k: unwrap_output(np.concatenate(output[k]), audio_original_length, n_overlapping_frames, hop_size)
305+
for k in output
314306
}
315307

316308
if debug_file:

0 commit comments

Comments
 (0)