File size: 523 Bytes
de60a6a 458da1c eb0bc41 ac0ec53 458da1c ac0ec53 6af81aa 458da1c 6af81aa 458da1c 6af81aa 458da1c 54c9435 de60a6a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
import gradio as gr
import matplotlib.pyplot as plt
import numpy as np
from scipy.io import wavfile
def create_spectrogram(audio_data, sample_rate):
# Crea lo spettrogramma
plt.specgram(audio_data, Fs=sample_rate)
# Salva lo spettrogramma in un file PNG
plt.savefig('spectrogram.png')
# Ritorna il file PNG dello spettrogramma
return 'spectrogram.png'
# Crea l'interfaccia Gradio
iface = gr.Interface(fn=create_spectrogram, inputs=gr.Audio(), outputs="image", enable_queue=False)
iface.launch()
|