mirror of
https://github.com/chidiwilliams/buzz.git
synced 2026-03-15 07:05:48 +01:00
This also changes how models for Whisper.cpp are downloaded. After update of the app models will need to be re-downloaded if you have them already downloaded.
25 lines
1,000 B
Python
25 lines
1,000 B
Python
from buzz.model_loader import TranscriptionModel, ModelType, WhisperModelSize
|
|
from buzz.transcriber.transcriber import TranscriptionOptions, Task
|
|
from buzz.transcriber.whisper_cpp import WhisperCpp
|
|
from tests.audio import test_audio_path
|
|
from tests.model_loader import get_model_path
|
|
|
|
|
|
class TestWhisperCpp:
|
|
def test_transcribe(self):
|
|
transcription_options = TranscriptionOptions(
|
|
language="fr",
|
|
task=Task.TRANSCRIBE,
|
|
word_level_timings=False,
|
|
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.get_params(transcription_options=transcription_options)
|
|
result = whisper_cpp.transcribe(audio=test_audio_path, params=params)
|
|
|
|
assert "Bienvenue dans Passe" in result["text"]
|