mirror of
https://github.com/chidiwilliams/buzz.git
synced 2026-03-14 22:55:46 +01:00
Reduce duration of test audio (#214)
This commit is contained in:
parent
d95db970eb
commit
8f9d08ee5e
5 changed files with 11 additions and 11 deletions
3
.github/workflows/ci.yml
vendored
3
.github/workflows/ci.yml
vendored
|
|
@ -69,7 +69,6 @@ jobs:
|
|||
matrix:
|
||||
include:
|
||||
- os: macos-latest
|
||||
- os: ubuntu-latest
|
||||
- os: windows-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
|
@ -77,7 +76,7 @@ jobs:
|
|||
submodules: recursive
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.9.13'
|
||||
python-version: '3.10.7'
|
||||
|
||||
- name: Install Poetry Action
|
||||
uses: snok/install-poetry@v1.3.1
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ class Signals(QObject):
|
|||
class WhisperCppFileTranscriber(QRunnable):
|
||||
signals: Signals
|
||||
duration_audio_ms = sys.maxsize # max int
|
||||
segments: List[Segment] = []
|
||||
segments: List[Segment]
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
|
|
@ -213,6 +213,7 @@ class WhisperCppFileTranscriber(QRunnable):
|
|||
self.word_level_timings = word_level_timings
|
||||
self.model_path = model_path
|
||||
self.signals = Signals()
|
||||
self.segments = []
|
||||
|
||||
self.process = QProcess()
|
||||
self.process.readyReadStandardError.connect(self.read_std_err)
|
||||
|
|
|
|||
BIN
testdata/whisper-french.mp3
vendored
BIN
testdata/whisper-french.mp3
vendored
Binary file not shown.
|
|
@ -187,7 +187,7 @@ class TestFileTranscriberWidget:
|
|||
widget.run_button.click()
|
||||
|
||||
output_file = open(output_file_path, 'r', encoding='utf-8')
|
||||
assert 'Bienvenue dans Passe-Relle, un podcast' in output_file.read()
|
||||
assert 'Bienvenue dans Passe' in output_file.read()
|
||||
|
||||
|
||||
class TestSettings:
|
||||
|
|
|
|||
|
|
@ -41,8 +41,8 @@ class TestWhisperCppFileTranscriber:
|
|||
@pytest.mark.parametrize(
|
||||
'task,output_text',
|
||||
[
|
||||
(Task.TRANSCRIBE, 'Bienvenue dans Passe-Relle, un podcast'),
|
||||
(Task.TRANSLATE, 'Welcome to Passe-Relle, a podcast'),
|
||||
(Task.TRANSCRIBE, 'Bienvenue dans Passe'),
|
||||
(Task.TRANSLATE, 'Welcome to Passe-Relle'),
|
||||
])
|
||||
def test_transcribe(self, qtbot, tmp_path: pathlib.Path, task: Task, output_text: str):
|
||||
output_file_path = tmp_path / 'whisper_cpp.txt'
|
||||
|
|
@ -84,11 +84,11 @@ class TestWhisperFileTranscriber:
|
|||
@pytest.mark.parametrize(
|
||||
'word_level_timings,output_format,output_text',
|
||||
[
|
||||
(False, OutputFormat.TXT, 'Bienvenue dans Passe-Relle, un podcast'),
|
||||
(False, OutputFormat.SRT, '1\n00:00:00.000 --> 00:00:06.560\n Bienvenue dans Passe-Relle, un podcast pensé pour évêyer la curiosité des apprenances'),
|
||||
(False, OutputFormat.VTT, 'WEBVTT\n\n00:00:00.000 --> 00:00:06.560\n Bienvenue dans Passe-Relle, un podcast pensé pour évêyer la curiosité des apprenances'),
|
||||
(False, OutputFormat.TXT, 'Bienvenue dans Passe-Relle'),
|
||||
(False, OutputFormat.SRT, '1\n00:00:00.000 --> 00:00:06.560\n Bienvenue dans Passe-Relle'),
|
||||
(False, OutputFormat.VTT, 'WEBVTT\n\n00:00:00.000 --> 00:00:06.560\n Bienvenue dans Passe'),
|
||||
(True, OutputFormat.SRT,
|
||||
'1\n00:00:00.040 --> 00:00:00.359\n Bienvenue dans\n\n2\n00:00:00.359 --> 00:00:00.419\n Passe-'),
|
||||
'1\n00:00:00.040 --> 00:00:00.299\n Bien\n\n2\n00:00:00.299 --> 00:00:00.329\nvenue dans\n\n3\n00:00:00.329 --> 00:00:00.429\n P\n\n4\n00:00:00.429 --> 00:00:00.589\nasse-'),
|
||||
])
|
||||
def test_transcribe(self, qtbot, tmp_path: pathlib.Path, word_level_timings: bool, output_format: OutputFormat, output_text: str):
|
||||
output_file_path = tmp_path / f'whisper.{output_format.value.lower()}'
|
||||
|
|
@ -161,4 +161,4 @@ class TestWhisperCpp:
|
|||
result = whisper_cpp.transcribe(
|
||||
audio='testdata/whisper-french.mp3', params=params)
|
||||
|
||||
assert 'Bienvenue dans Passe-Relle, un podcast' in result['text']
|
||||
assert 'Bienvenue dans Passe' in result['text']
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue