Fauno15 akhaliq HF staff commited on
Commit
5af5097
1 Parent(s): fe7487c

fix double audio issue (#3)

Browse files

- fix double audio issue (3b696cff8d28aaa93c94b0c3eb83cb60c6e68939)


Co-authored-by: Ahsen Khaliq <akhaliq@users.noreply.huggingface.co>

Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -8,7 +8,8 @@ pipeline = pipeline.to("cuda")
8
 
9
  def denoise(length_sec):
10
  audios = pipeline(audio_length_in_s=length_sec).audios
11
- scipy.io.wavfile.write("maestro_test.wav", pipeline.unet.sample_rate, audios)
 
12
  return "maestro_test.wav"
13
 
14
  gr.Interface(fn=denoise, inputs=gr.Slider(1.0, 6.0, value=3.0, step=0.5, label="Audio length in seconds"), outputs="audio").launch()
 
8
 
9
  def denoise(length_sec):
10
  audios = pipeline(audio_length_in_s=length_sec).audios
11
+ for audio in audios:
12
+ scipy.io.wavfile.write("maestro_test.wav", pipe.unet.sample_rate, audio.transpose())
13
  return "maestro_test.wav"
14
 
15
  gr.Interface(fn=denoise, inputs=gr.Slider(1.0, 6.0, value=3.0, step=0.5, label="Audio length in seconds"), outputs="audio").launch()