forked from chidiwilliams/buzz
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwhisper_cpp_test.py
More file actions
25 lines (21 loc) · 952 Bytes
/
whisper_cpp_test.py
File metadata and controls
25 lines (21 loc) · 952 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from buzz.model_loader import TranscriptionModel, ModelType, WhisperModelSize
from buzz.transcriber.transcriber import TranscriptionOptions, Task
from buzz.transcriber.whisper_cpp import WhisperCpp, whisper_cpp_params
from tests.model_loader import get_model_path
class TestWhisperCpp:
def test_transcribe(self):
transcription_options = TranscriptionOptions(
model=TranscriptionModel(
model_type=ModelType.WHISPER_CPP,
whisper_model_size=WhisperModelSize.TINY,
)
)
model_path = get_model_path(transcription_options.model)
whisper_cpp = WhisperCpp(model=model_path)
params = whisper_cpp_params(
language="fr", task=Task.TRANSCRIBE, word_level_timings=False
)
result = whisper_cpp.transcribe(
audio="testdata/whisper-french.mp3", params=params
)
assert "Bienvenue dans Passe" in result["text"]