emirhanbilgic commited on
Commit
62196f9
·
verified ·
1 Parent(s): 5f01cca

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -129,8 +129,12 @@ def text_to_speech(text, audio_file=None):
129
  # Convert the generated speech to numpy array format
130
  speech_np = speech.cpu().numpy()
131
 
132
- # Return the numpy array and the sample rate
133
- return (speech_np, 16000)
 
 
 
 
134
 
135
  iface = gr.Interface(
136
  fn=text_to_speech,
 
129
  # Convert the generated speech to numpy array format
130
  speech_np = speech.cpu().numpy()
131
 
132
+ # Save the speech to a temporary file in WAV format
133
+ output_file = "output.wav"
134
+ sf.write(output_file, speech_np, 16000)
135
+
136
+ # Return the path to the audio file
137
+ return output_file
138
 
139
  iface = gr.Interface(
140
  fn=text_to_speech,