alexander-lazarin commited on
Commit
e24d3c1
·
1 Parent(s): 3225caa

Read gr.Audio input via filepath

Browse files
Files changed (1) hide show
  1. app.py +2 -3
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
- sample_rate, audio_data = voice
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)