L0SG commited on
Commit
cfe9514
1 Parent(s): eac4c42
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -51,10 +51,16 @@ def inference_gradio(input, model_choice): # input is audio waveform in [T, cha
51
  spec_plot_gen = plot_spectrogram(spec_gen)
52
 
53
  output_audio = (h.sampling_rate, output) # tuple for gr.Audio output
54
- output_image = PIL.Image.frombytes(
55
- "RGB",
 
 
56
  spec_plot_gen.canvas.get_width_height(),
57
- spec_plot_gen.canvas.tostring_rgb(),
 
 
 
 
58
  )
59
 
60
  return output_audio, output_image
 
51
  spec_plot_gen = plot_spectrogram(spec_gen)
52
 
53
  output_audio = (h.sampling_rate, output) # tuple for gr.Audio output
54
+
55
+ buffer = spec_plot_gen.canvas.buffer_rgba()
56
+ output_image = PIL.Image.frombuffer(
57
+ "RGBA",
58
  spec_plot_gen.canvas.get_width_height(),
59
+ buffer,
60
+ "raw",
61
+ "RGBA",
62
+ 0,
63
+ 1
64
  )
65
 
66
  return output_audio, output_image