Spaces:
Running
on
Zero
Running
on
Zero
| from abc import ABC, abstractmethod | |
| from typing import Any, Iterable | |
| class IVoiceActivityEngine(ABC): | |
| """Contract for a Voice Activity Detector (VAD).""" | |
| def __call__(self, audio_chunk: bytes) -> bool: | |
| """ | |
| Analyzes an audio chunk and returns True if speech is detected, | |
| False otherwise. | |
| """ | |
| pass | |
| class IStreamingSpeechEngine(ABC): | |
| """Contract for a streaming transcription service.""" | |
| def transcribe_chunk(self, audio_chunk: bytes) -> str: | |
| """Processes an audio chunk and returns a transcription (partial or final).""" | |
| pass | |
| def finalize_segment(self) -> str: | |
| """Called at the end of the stream to get the final transcription.""" | |
| pass | |