tgritsaev's picture
Upload 198 files
affcd23 verified
raw
history blame contribute delete
281 Bytes
import io
import matplotlib.pyplot as plt
def plot_spectrogram_to_buf(spectrogram_tensor, name=None):
plt.figure(figsize=(20, 5))
plt.imshow(spectrogram_tensor)
plt.title(name)
buf = io.BytesIO()
plt.savefig(buf, format='png')
buf.seek(0)
return buf