mirror of
https://github.com/ijaric/voice_assistant.git
synced 2025-05-24 14:33:26 +00:00
15 lines
342 B
Python
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)
|