Update tts.py
Browse files
tts.py
CHANGED
@@ -33,7 +33,7 @@ def synthesize_speech(text):
|
|
33 |
# Decode the generated speech and save to an audio file
|
34 |
waveform = speech.cpu().numpy().flatten()
|
35 |
# Use torchaudio to save the waveform
|
36 |
-
file_path = "output.wav"
|
37 |
torchaudio.save(file_path, torch.tensor(waveform).unsqueeze(0), 16000)
|
38 |
logging.info(f"Audio file saved successfully at {file_path}.")
|
39 |
return file_path
|
|
|
33 |
# Decode the generated speech and save to an audio file
|
34 |
waveform = speech.cpu().numpy().flatten()
|
35 |
# Use torchaudio to save the waveform
|
36 |
+
file_path = "/tmp/output.wav" # Use a temporary directory
|
37 |
torchaudio.save(file_path, torch.tensor(waveform).unsqueeze(0), 16000)
|
38 |
logging.info(f"Audio file saved successfully at {file_path}.")
|
39 |
return file_path
|