Make Faster Whisper and OpenAI Whisper work

This commit is contained in:
mesonium
2024-07-03 18:43:27 +02:00
committed by hueso
parent b0adecef7a
commit 2d7630a757
7 changed files with 261 additions and 51 deletions

View File

@@ -37,7 +37,6 @@ class Configuration:
class WhisperModel(Model):
def __init__(self):
# TODO
self._result: str = ''
self._config = OpenAIWhisperSettings()
@@ -45,7 +44,7 @@ class WhisperModel(Model):
def result(self) -> str:
return self._result
def transcribe(self, result: Results, audio_file: Path) -> str:
def transcribe(self, result: Results, audio_file: Path) -> None:
model = whisper.load_model(self._config.model_size)
log.debug('model size is used = %s', self._config.model_size)
result.text = model.transcribe(audio_file)['text'] # pyright: ignore [reportAttributeAccessIssue]