|
| 1 | +from automation.utils.appnexus.base import Adapter |
| 2 | +from automation.utils.appnexus.base import Backend |
| 3 | +from automation.utils.appnexus.base import BackendFactory |
| 4 | +from automation.utils.appnexus.base import BackendRequest |
| 5 | +from automation.utils.appnexus.base import BackendResponse |
| 6 | + |
| 7 | + |
| 8 | +class WhisperRequest(BackendRequest): |
| 9 | + def __init__(self) -> None: |
| 10 | + super().__init__() |
| 11 | + |
| 12 | +class WhisperResponse(BackendResponse): |
| 13 | + def __init__(self) -> None: |
| 14 | + super().__init__() |
| 15 | + |
| 16 | + |
| 17 | +class Whisper(Backend): |
| 18 | + def connect(self) -> None: |
| 19 | + raise NotImplementedError("The 'connect' method is not implemented for the 'Whisper' backend.") |
| 20 | + |
| 21 | + def make_request(self, request: WhisperRequest) -> WhisperResponse: |
| 22 | + # Implement production backend here. |
| 23 | + pass |
| 24 | + |
| 25 | + @classmethod |
| 26 | + def _create_instance(cls) -> 'Whisper': |
| 27 | + return cls() |
| 28 | + |
| 29 | +class LocalWhisper(Backend): |
| 30 | + def make_request(self, request: WhisperRequest) -> WhisperResponse: |
| 31 | + # Implement your local backend here. |
| 32 | + pass |
| 33 | + |
| 34 | + |
| 35 | +class WhisperBackendFactory(BackendFactory): |
| 36 | + def create_backend(self) -> Backend: |
| 37 | + # Return backend based on some setting. |
| 38 | + return super().create_backend() |
| 39 | + |
| 40 | + |
| 41 | +class WhisperAdapter(Adapter): |
| 42 | + def transcribe(self, caption_file_id: str) -> WhisperResponse: |
| 43 | + request = WhisperRequest() |
| 44 | + return self.backend.make_request(request) |
0 commit comments