Getting started on docstrings

This commit is contained in:
Moishe Lettvin
2024-03-07 12:51:19 -05:00
parent 337ca7f581
commit 8fb92e3fd7
3 changed files with 63 additions and 28 deletions

View File

@@ -100,23 +100,14 @@ class TTSService(AIService):
# yield empty bytes here, so linting can infer what this method does
yield bytes()
<<<<<<< HEAD
async def process_frame(self, frame: Frame) -> AsyncGenerator[Frame, None]:
if isinstance(frame, EndFrame):
if self.current_sentence:
async for audio_chunk in self.run_tts(self.current_sentence):
yield AudioFrame(audio_chunk)
yield frame
yield TextFrame(self.current_sentence)
if not isinstance(frame, TextFrame):
=======
async def process_frame(self, frame: QueueFrame) -> AsyncGenerator[QueueFrame, None]:
if not isinstance(frame, TextQueueFrame):
if self.current_sentence:
async for audio_chunk in self.run_tts(self.current_sentence):
yield AudioQueueFrame(audio_chunk)
>>>>>>> fa5f38c (frame and pipeline docstrings)
yield frame
return
@@ -133,12 +124,9 @@ class TTSService(AIService):
async for audio_chunk in self.run_tts(text):
yield AudioFrame(audio_chunk)
<<<<<<< HEAD
# note we pass along the text frame *after* the audio, so the text frame is completed after the audio is processed.
yield TextFrame(text)
=======
>>>>>>> fa5f38c (frame and pipeline docstrings)
# Convenience function to send the audio for a sentence to the given queue
async def say(self, sentence, queue: asyncio.Queue):
await self.run_to_queue(queue, [TextFrame(sentence)])