services(riva): check service config before running tts
This commit is contained in:
@@ -70,6 +70,11 @@ class FastpitchTTSService(TTSService):
|
|||||||
|
|
||||||
self._service = riva.client.SpeechSynthesisService(auth)
|
self._service = riva.client.SpeechSynthesisService(auth)
|
||||||
|
|
||||||
|
# warm up the service
|
||||||
|
config_response = self._service.stub.GetRivaSynthesisConfig(
|
||||||
|
riva.client.proto.riva_tts_pb2.RivaSynthesisConfigRequest()
|
||||||
|
)
|
||||||
|
|
||||||
async def run_tts(self, text: str) -> AsyncGenerator[Frame, None]:
|
async def run_tts(self, text: str) -> AsyncGenerator[Frame, None]:
|
||||||
def read_audio_responses():
|
def read_audio_responses():
|
||||||
try:
|
try:
|
||||||
@@ -87,11 +92,10 @@ class FastpitchTTSService(TTSService):
|
|||||||
logger.error(f"{self} exception: {e}")
|
logger.error(f"{self} exception: {e}")
|
||||||
return []
|
return []
|
||||||
|
|
||||||
logger.debug(f"Generating TTS: [{text}]")
|
|
||||||
|
|
||||||
await self.start_ttfb_metrics()
|
await self.start_ttfb_metrics()
|
||||||
yield TTSStartedFrame()
|
yield TTSStartedFrame()
|
||||||
|
|
||||||
|
logger.debug(f"Generating TTS: [{text}]")
|
||||||
responses = await asyncio.to_thread(read_audio_responses)
|
responses = await asyncio.to_thread(read_audio_responses)
|
||||||
|
|
||||||
for resp in responses:
|
for resp in responses:
|
||||||
|
|||||||
Reference in New Issue
Block a user