Skip to content

Commit

Permalink
Merge branch 'main' into I18n_pl
Browse files Browse the repository at this point in the history
  • Loading branch information
Piciok authored Apr 24, 2023
2 parents 41c8455 + a7e7776 commit 52d05ab
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 7 deletions.
5 changes: 3 additions & 2 deletions buzz/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -1021,8 +1021,9 @@ def on_new_transcription_action_triggered(self):
self.open_file_transcriber_widget(file_paths)

def open_file_transcriber_widget(self, file_paths: List[str]):
file_transcriber_window = FileTranscriberWidget(
file_paths, self.openai_access_token, self, flags=Qt.WindowType.Window)
file_transcriber_window = FileTranscriberWidget(file_paths=file_paths,
openai_access_token=self.openai_access_token, parent=self,
flags=Qt.WindowType.Window)
file_transcriber_window.triggered.connect(
self.on_file_transcriber_triggered)
file_transcriber_window.openai_access_token_changed.connect(self.on_openai_access_token_changed)
Expand Down
3 changes: 3 additions & 0 deletions buzz/settings/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@ def set_value(self, key: Key, value: typing.Any) -> None:
def value(self, key: Key, default_value: typing.Any, value_type: typing.Optional[type] = None) -> typing.Any:
return self.settings.value(key.value, default_value,
value_type if value_type is not None else type(default_value))

def clear(self):
self.settings.clear()
7 changes: 7 additions & 0 deletions tests/gui_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
RecordingTranscriberWidget,
TemperatureValidator, TranscriptionTasksTableWidget, HuggingFaceSearchLineEdit,
TranscriptionOptionsGroupBox)
from buzz.settings.settings import Settings
from buzz.widgets.transcription_viewer_widget import TranscriptionViewerWidget
from buzz.model_loader import ModelType
from buzz.transcriber import (FileTranscriptionOptions, FileTranscriptionTask,
Expand Down Expand Up @@ -298,6 +299,12 @@ def _get_toolbar_action(window: MainWindow, text: str):
return [action for action in toolbar.actions() if action.text() == text][0]


@pytest.fixture(scope='module', autouse=True)
def clear_settings():
settings = Settings()
settings.clear()


class TestFileTranscriberWidget:
def test_should_set_window_title(self, qtbot: QtBot):
widget = FileTranscriberWidget(
Expand Down
11 changes: 7 additions & 4 deletions tests/transcriber_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@ class TestWhisperCppFileTranscriber:
@pytest.mark.parametrize(
'word_level_timings,expected_segments',
[
(False, [Segment(0, 1840, 'Bienvenue dans Passe Relle.')]),
(True, [Segment(30, 280, 'Bien'), Segment(280, 630, 'venue')])
(False, [Segment(0, 6560,
'Bienvenue dans Passe-Relle. Un podcast pensé pour')]),
(True, [Segment(0, 30, ''), Segment(30, 330, 'Bien'), Segment(330, 740, 'venue')])
])
def test_transcribe(self, qtbot: QtBot, word_level_timings: bool, expected_segments: List[Segment]):
file_transcription_options = FileTranscriptionOptions(
Expand All @@ -89,8 +90,10 @@ def test_transcribe(self, qtbot: QtBot, word_level_timings: bool, expected_segme

mock_progress.assert_called()
segments = mock_completed.call_args[0][0]
for expected_segment in expected_segments:
assert expected_segment in segments
for i, expected_segment in enumerate(expected_segments):
assert expected_segment.start == segments[i].start
assert expected_segment.end == segments[i].end
assert expected_segment.text in segments[i].text


class TestWhisperFileTranscriber:
Expand Down
2 changes: 1 addition & 1 deletion whisper.cpp
Submodule whisper.cpp updated 105 files

0 comments on commit 52d05ab

Please sign in to comment.