lpw commited on
Commit
4461b69
1 Parent(s): 2115e90

Update audio_pipe.py

Browse files
Files changed (1) hide show
  1. audio_pipe.py +4 -4
audio_pipe.py CHANGED
@@ -4,6 +4,7 @@ from pathlib import Path
4
  from typing import List, Tuple
5
  import tempfile
6
  import soundfile as sf
 
7
 
8
  import numpy as np
9
  import torch
@@ -150,12 +151,11 @@ class SpeechToSpeechPipeline():
150
  wav, sr = TTSHubInterface.get_prediction(
151
  self.tts_task, self.tts_model, self.tts_generator, tts_sample
152
  )
153
- temp_name = ""
154
  with tempfile.NamedTemporaryFile(suffix=".wav") as tmp_output_file:
155
  sf.write(tmp_output_file, wav.detach().cpu().numpy(), sr)
156
  tmp_output_file.seek(0)
157
- temp_name = tmp_output_file.name
158
- print(temp_name)
159
 
160
  # return wav, sr, [text]
161
- return temp_name
4
  from typing import List, Tuple
5
  import tempfile
6
  import soundfile as sf
7
+ import gradio as gr
8
 
9
  import numpy as np
10
  import torch
151
  wav, sr = TTSHubInterface.get_prediction(
152
  self.tts_task, self.tts_model, self.tts_generator, tts_sample
153
  )
154
+ temp_file = ""
155
  with tempfile.NamedTemporaryFile(suffix=".wav") as tmp_output_file:
156
  sf.write(tmp_output_file, wav.detach().cpu().numpy(), sr)
157
  tmp_output_file.seek(0)
158
+ temp_file = gr.Audio(tmp_output_file.name)
 
159
 
160
  # return wav, sr, [text]
161
+ return temp_file