Update app.py
Browse files
app.py
CHANGED
@@ -2,13 +2,14 @@ import gradio as gr
|
|
2 |
import numpy as np
|
3 |
import librosa
|
4 |
|
5 |
-
# import the librosa library for converting a Mel spectrogram image
|
6 |
|
7 |
-
def
|
8 |
-
# convert the Mel spectrogram image
|
9 |
-
|
10 |
-
|
|
|
11 |
|
12 |
# create the gradio app
|
13 |
-
app = gr.Interface(
|
14 |
app.launch()
|
|
|
2 |
import numpy as np
|
3 |
import librosa
|
4 |
|
5 |
+
# import the librosa library for converting audio to a Mel spectrogram image
|
6 |
|
7 |
+
def audio_to_mel(audio):
|
8 |
+
# convert the audio to a Mel spectrogram image using librosa
|
9 |
+
# specify the data type of the output array to avoid the same_kind casting error
|
10 |
+
mel_spectrogram = librosa.feature.melspectrogram(audio, dtype=np.float64)
|
11 |
+
return mel_spectrogram
|
12 |
|
13 |
# create the gradio app
|
14 |
+
app = gr.Interface(audio_to_mel, "audio", "image")
|
15 |
app.launch()
|