Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -13,7 +13,7 @@ def custom_feature_extraction(audio, sr=16000, n_mels=128, n_fft=2048, hop_lengt
|
|
13 |
S_DB = librosa.power_to_db(S, ref=np.max)
|
14 |
pitches, _ = librosa.piptrack(y=audio, sr=sr, n_fft=n_fft, hop_length=hop_length)
|
15 |
spectral_centroids = librosa.feature.spectral_centroid(y=audio, sr=sr, n_fft=n_fft, hop_length=hop_length)
|
16 |
-
features = np.concatenate([S_DB, pitches, spectral_centroids], axis=0)
|
17 |
features_tensor = torch.tensor(features).float()
|
18 |
if features_tensor.shape[1] > target_length:
|
19 |
features_tensor = features_tensor[:, :target_length]
|
|
|
13 |
S_DB = librosa.power_to_db(S, ref=np.max)
|
14 |
pitches, _ = librosa.piptrack(y=audio, sr=sr, n_fft=n_fft, hop_length=hop_length)
|
15 |
spectral_centroids = librosa.feature.spectral_centroid(y=audio, sr=sr, n_fft=n_fft, hop_length=hop_length)
|
16 |
+
features = np.concatenate([S_DB, pitches.max(axis=1, keepdims=True), spectral_centroids], axis=0)
|
17 |
features_tensor = torch.tensor(features).float()
|
18 |
if features_tensor.shape[1] > target_length:
|
19 |
features_tensor = features_tensor[:, :target_length]
|