Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,8 +4,8 @@ import azure.cognitiveservices.speech as speechsdk
|
|
| 4 |
first_alert = "first.wav"
|
| 5 |
next_alert = "next.wav"
|
| 6 |
|
| 7 |
-
def Txt_To_Speech(SpeechRegion, SpeechKey,
|
| 8 |
-
if (SpeechRegion == '' or SpeechKey == '' or
|
| 9 |
output= first_alert
|
| 10 |
else:
|
| 11 |
try:
|
|
@@ -16,8 +16,7 @@ def Txt_To_Speech(SpeechRegion, SpeechKey, statements):
|
|
| 16 |
|
| 17 |
speech_synthesizer = speechsdk.SpeechSynthesizer(speech_config=speech_config, audio_config=audio_config)
|
| 18 |
|
| 19 |
-
|
| 20 |
-
|
| 21 |
with tempfile.NamedTemporaryFile(suffix=".mp3", delete=False) as temp_file:
|
| 22 |
temp_file.write(speech_synthesizer.speak_text_async(text).get())
|
| 23 |
|
|
|
|
| 4 |
first_alert = "first.wav"
|
| 5 |
next_alert = "next.wav"
|
| 6 |
|
| 7 |
+
def Txt_To_Speech(SpeechRegion, SpeechKey, text):
|
| 8 |
+
if (SpeechRegion == '' or SpeechKey == '' or text == ''):
|
| 9 |
output= first_alert
|
| 10 |
else:
|
| 11 |
try:
|
|
|
|
| 16 |
|
| 17 |
speech_synthesizer = speechsdk.SpeechSynthesizer(speech_config=speech_config, audio_config=audio_config)
|
| 18 |
|
| 19 |
+
|
|
|
|
| 20 |
with tempfile.NamedTemporaryFile(suffix=".mp3", delete=False) as temp_file:
|
| 21 |
temp_file.write(speech_synthesizer.speak_text_async(text).get())
|
| 22 |
|