import librosa import torch def preprocess(audio_file): # Load the audio file y, sr = librosa.load(audio_file, sr=None) mfccs = librosa.feature.mfcc(y=y, sr=sr, n_mfcc=13) tensor = torch.from_numpy(mfccs)[None] return tensor