Spaces:
Runtime error
Runtime error
Commit
·
bdf63e1
1
Parent(s):
f076af9
Update app.py
Browse files
app.py
CHANGED
|
@@ -14,14 +14,12 @@ subscription_region = "[AZURE_SPEECH_API_REGION]"
|
|
| 14 |
# Input SSML file
|
| 15 |
# Open this file to change or fine-tune the pitch, pronunciation, speaking rate, volume, voice, language and more
|
| 16 |
# https://github.com/MicrosoftDocs/azure-docs/blob/master/articles/cognitive-services/Speech-Service/language-support.md#neural-voices
|
| 17 |
-
input_folder = "main"
|
| 18 |
input_file = "ssml.xml"
|
| 19 |
|
| 20 |
# https://docs.microsoft.com/nl-nl/python/api/azure-cognitiveservices-speech/azure.cognitiveservices.speech.speechsynthesisoutputformat?view=azure-python
|
| 21 |
audio_format = "Riff24Khz16BitMonoPcm"
|
| 22 |
|
| 23 |
# Output folder and file
|
| 24 |
-
output_folder = "main"
|
| 25 |
output_file = f"file-{random.randint(10000,99999)}.wav"
|
| 26 |
|
| 27 |
speech_config = SpeechConfig(subscription=subscription_key, region=subscription_region)
|
|
@@ -30,7 +28,7 @@ speech_config.set_speech_synthesis_output_format(
|
|
| 30 |
)
|
| 31 |
synthesizer = SpeechSynthesizer(speech_config=speech_config, audio_config=None)
|
| 32 |
|
| 33 |
-
input = open(f"{
|
| 34 |
result = synthesizer.speak_ssml_async(input).get()
|
| 35 |
|
| 36 |
stream = AudioDataStream(result)
|
|
|
|
| 14 |
# Input SSML file
|
| 15 |
# Open this file to change or fine-tune the pitch, pronunciation, speaking rate, volume, voice, language and more
|
| 16 |
# https://github.com/MicrosoftDocs/azure-docs/blob/master/articles/cognitive-services/Speech-Service/language-support.md#neural-voices
|
|
|
|
| 17 |
input_file = "ssml.xml"
|
| 18 |
|
| 19 |
# https://docs.microsoft.com/nl-nl/python/api/azure-cognitiveservices-speech/azure.cognitiveservices.speech.speechsynthesisoutputformat?view=azure-python
|
| 20 |
audio_format = "Riff24Khz16BitMonoPcm"
|
| 21 |
|
| 22 |
# Output folder and file
|
|
|
|
| 23 |
output_file = f"file-{random.randint(10000,99999)}.wav"
|
| 24 |
|
| 25 |
speech_config = SpeechConfig(subscription=subscription_key, region=subscription_region)
|
|
|
|
| 28 |
)
|
| 29 |
synthesizer = SpeechSynthesizer(speech_config=speech_config, audio_config=None)
|
| 30 |
|
| 31 |
+
input = open(f"{input_file}", "r").read()
|
| 32 |
result = synthesizer.speak_ssml_async(input).get()
|
| 33 |
|
| 34 |
stream = AudioDataStream(result)
|