Created
March 15, 2021 06:50
-
-
Save AyishaR/fdc3775bd56e24c78193027e5685ec68 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ind = int(np.random.uniform()*len(inputs_test)) | |
spectrogram_out = inputs_test[ind] | |
ipd.Audio(spectrogram_out, rate=desired_sr) | |
y = labels_test[ind] | |
output = model.predict(np.expand_dims(np.array([inputs_test[ind]]), 0)) | |
print("True label:", textLabel(np.argmax(y))) | |
print("Prediction:", textLabel(np.argmax(output))) | |
plt.imshow(spectrogram_out, cmap='hot', interpolation='nearest', aspect='auto') | |
plt.show() | |
# Playing the sample | |
''' | |
audio = librosa.core.istft(spectrogram_out, hop_length=hop_len, win_length=win_len) | |
playback_sr, audio_interpolated = interpolateAudio(audio) | |
ipd.Audio(audio_interpolated, rate=playback_sr, autoplay=True) | |
''' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment