1
0
mirror of https://github.com/ijaric/voice_assistant.git synced 2025-05-24 14:33:26 +00:00
voice_assistant/src/assistant/lib/stt/services.py
2023-10-07 05:56:33 +03:00

15 lines
342 B
Python

import typing
class STTProtocol(typing.Protocol):
async def speech_to_text(self, audio: bytes) -> str:
...
class SpeechService:
def __init__(self, repository: STTProtocol):
self.repository = repository
async def recognize(self, audio: bytes) -> str:
return await self.repository.speech_to_text(audio)