Spaces:
Runtime error
Runtime error
Commit
·
f62a7d4
1
Parent(s):
ae6b6a0
Relauch TTS
Browse files
app.py
CHANGED
@@ -46,12 +46,7 @@ from langchain.document_loaders import (
|
|
46 |
from langchain.text_splitter import RecursiveCharacterTextSplitter
|
47 |
from langchain.docstore.document import Document
|
48 |
|
49 |
-
|
50 |
-
audio_config = speechsdk.audio.AudioOutputConfig(use_default_speaker=True)
|
51 |
-
speech_config.speech_synthesis_voice_name='en-US-JennyNeural'
|
52 |
-
global speech_synthesizer
|
53 |
-
speech_synthesizer = ""
|
54 |
-
# speech_synthesizer = speechsdk.SpeechSynthesizer(speech_config=speech_config, audio_config=audio_config)
|
55 |
|
56 |
# Custom document loaders
|
57 |
class MyElmLoader(UnstructuredEmailLoader):
|
@@ -210,8 +205,13 @@ class DB_Search(BaseTool):
|
|
210 |
raise NotImplementedError("N/A")
|
211 |
|
212 |
def Text2Sound(text):
|
213 |
-
|
214 |
-
|
|
|
|
|
|
|
|
|
|
|
215 |
# if speech_synthesis_result.reason == speechsdk.ResultReason.SynthesizingAudioCompleted:
|
216 |
# print("Speech synthesized for text [{}]".format(text))
|
217 |
# elif speech_synthesis_result.reason == speechsdk.ResultReason.Canceled:
|
@@ -222,6 +222,7 @@ def Text2Sound(text):
|
|
222 |
# print("Error details: {}".format(cancellation_details.error_details))
|
223 |
# print("Did you set the speech resource key and region values?")
|
224 |
print("test")
|
|
|
225 |
pass
|
226 |
|
227 |
Text2Sound_tool = Tool(
|
|
|
46 |
from langchain.text_splitter import RecursiveCharacterTextSplitter
|
47 |
from langchain.docstore.document import Document
|
48 |
|
49 |
+
|
|
|
|
|
|
|
|
|
|
|
50 |
|
51 |
# Custom document loaders
|
52 |
class MyElmLoader(UnstructuredEmailLoader):
|
|
|
205 |
raise NotImplementedError("N/A")
|
206 |
|
207 |
def Text2Sound(text):
|
208 |
+
|
209 |
+
speech_config = speechsdk.SpeechConfig(subscription=os.getenv('SPEECH_KEY'), region=os.getenv('SPEECH_REGION'))
|
210 |
+
audio_config = speechsdk.audio.AudioOutputConfig(use_default_speaker=True)
|
211 |
+
speech_config.speech_synthesis_voice_name='en-US-JennyNeural'
|
212 |
+
# speech_synthesizer = ""
|
213 |
+
speech_synthesizer = speechsdk.SpeechSynthesizer(speech_config=speech_config, audio_config=audio_config)
|
214 |
+
speech_synthesis_result = speech_synthesizer.speak_text_async(text).get()
|
215 |
# if speech_synthesis_result.reason == speechsdk.ResultReason.SynthesizingAudioCompleted:
|
216 |
# print("Speech synthesized for text [{}]".format(text))
|
217 |
# elif speech_synthesis_result.reason == speechsdk.ResultReason.Canceled:
|
|
|
222 |
# print("Error details: {}".format(cancellation_details.error_details))
|
223 |
# print("Did you set the speech resource key and region values?")
|
224 |
print("test")
|
225 |
+
return speech_synthesis_result
|
226 |
pass
|
227 |
|
228 |
Text2Sound_tool = Tool(
|