Skip to content

Instantly share code, notes, and snippets.

@AyishaR
Created March 15, 2021 06:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AyishaR/fdc3775bd56e24c78193027e5685ec68 to your computer and use it in GitHub Desktop.
Save AyishaR/fdc3775bd56e24c78193027e5685ec68 to your computer and use it in GitHub Desktop.
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