mirror of
https://github.com/gradio-app/gradio.git
synced 2025-01-24 10:54:04 +08:00
fix spectogram
This commit is contained in:
parent
3b4a33c7ec
commit
f56a936cac
@ -8,13 +8,14 @@ from scipy import signal
|
||||
|
||||
def spectrogram(audio):
|
||||
sr, data = audio
|
||||
data = np.delete(data, 1, 1).reshape(-1)
|
||||
frequencies, times, spectrogram_data = signal.spectrogram(data.reshape(-1), sr, window="hamming")
|
||||
if len(data.shape) == 2:
|
||||
data = np.mean(data, axis=0)
|
||||
frequencies, times, spectrogram_data = signal.spectrogram(data, sr, window="hamming")
|
||||
plt.pcolormesh(times, frequencies, np.log10(spectrogram_data))
|
||||
return plt
|
||||
|
||||
|
||||
io = gr.Interface(spectrogram, "audio", "plot
|
||||
io = gr.Interface(spectrogram, "audio", "plot")
|
||||
|
||||
io.test_launch()
|
||||
io.launch()
|
||||
|
Loading…
Reference in New Issue
Block a user