Autopep linter fixes

This commit is contained in:
Moishe Lettvin
2024-01-25 12:12:46 -05:00
parent f0d9b0613e
commit 5fdda43bed
27 changed files with 147 additions and 68 deletions

View File

@@ -65,7 +65,7 @@ class AIService:
raise e
@abstractmethod
async def process_frame(self, frame:QueueFrame) -> AsyncGenerator[QueueFrame, None]:
async def process_frame(self, frame: QueueFrame) -> AsyncGenerator[QueueFrame, None]:
if isinstance(frame, ControlQueueFrame):
yield frame
@@ -75,6 +75,7 @@ class AIService:
if False:
yield QueueFrame()
class LLMService(AIService):
@abstractmethod
async def run_llm_async(self, messages) -> AsyncGenerator[str, None]:
@@ -146,7 +147,7 @@ class ImageGenService(AIService):
# Renders the image. Returns an Image object.
@abstractmethod
async def run_image_gen(self, sentence:str) -> tuple[str, bytes]:
async def run_image_gen(self, sentence: str) -> tuple[str, bytes]:
pass
async def process_frame(self, frame: QueueFrame) -> AsyncGenerator[QueueFrame, None]:
@@ -157,15 +158,16 @@ class ImageGenService(AIService):
(url, image_data) = await self.run_image_gen(frame.text)
yield ImageQueueFrame(url, image_data)
class STTService(AIService):
"""STTService is a base class for speech-to-text services."""
_frame_rate: int
def __init__(self, frame_rate: int = 16000, **kwargs):
super().__init__(**kwargs)
self._frame_rate = frame_rate
@abstractmethod
async def run_stt(self, audio: BinaryIO) -> str:
"""Returns transcript as a string"""
@@ -188,6 +190,7 @@ class STTService(AIService):
text = await self.run_stt(content)
yield TextQueueFrame(text)
@dataclass
class AIServiceConfig:
tts: TTSService