Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -16,13 +16,16 @@ def Txt_To_Speech(SpeechRegion, SpeechKey, text):
|
|
| 16 |
|
| 17 |
speech_synthesizer = speechsdk.SpeechSynthesizer(speech_config=speech_config, audio_config=audio_config)
|
| 18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
temp_file.write(speech_synthesizer.speak_text_async(text).get())
|
| 23 |
|
| 24 |
-
temp_file_path = temp_file.name
|
| 25 |
-
output = temp_file_path
|
| 26 |
except :
|
| 27 |
output = next_alert
|
| 28 |
return output
|
|
|
|
| 16 |
|
| 17 |
speech_synthesizer = speechsdk.SpeechSynthesizer(speech_config=speech_config, audio_config=audio_config)
|
| 18 |
|
| 19 |
+
result = speech_synthesizer.speak_text_async(text).get()
|
| 20 |
+
|
| 21 |
+
stream = speechsdk.AudioDataStream(result)
|
| 22 |
+
output = stream.save_to_wav_file("file.wav")
|
| 23 |
|
| 24 |
+
#with tempfile.NamedTemporaryFile(suffix=".mp3", delete=False) as temp_file:
|
| 25 |
+
#temp_file.write(speech_synthesizer.speak_text_async(text).get())
|
|
|
|
| 26 |
|
| 27 |
+
#temp_file_path = temp_file.name
|
| 28 |
+
#output = temp_file_path
|
| 29 |
except :
|
| 30 |
output = next_alert
|
| 31 |
return output
|