Spaces:
Sleeping
Sleeping
Commit
·
e24d3c1
1
Parent(s):
3225caa
Read gr.Audio input via filepath
Browse files
app.py
CHANGED
@@ -26,13 +26,12 @@ def get_voice(voice):
|
|
26 |
global voice_rec
|
27 |
voice_rec = voice
|
28 |
|
29 |
-
voice = gr.Audio()
|
30 |
label = [gr.Label(), gr.Image()]
|
31 |
|
32 |
def voice_to_image(voice):
|
33 |
|
34 |
-
|
35 |
-
audio_data = audio_data.astype(np.float32) # / 32767.0
|
36 |
|
37 |
# Generate the spectrogram using librosa
|
38 |
spectrogram = librosa.stft(audio_data)
|
|
|
26 |
global voice_rec
|
27 |
voice_rec = voice
|
28 |
|
29 |
+
voice = gr.Audio(type='filepath')
|
30 |
label = [gr.Label(), gr.Image()]
|
31 |
|
32 |
def voice_to_image(voice):
|
33 |
|
34 |
+
audio_data, sample_rate = librosa.load(voice)
|
|
|
35 |
|
36 |
# Generate the spectrogram using librosa
|
37 |
spectrogram = librosa.stft(audio_data)
|