From a9ad52d212f44fe39c552ecc592f250b89f1b793 Mon Sep 17 00:00:00 2001 From: Chidi Williams Date: Sat, 29 Apr 2023 22:02:53 +0100 Subject: [PATCH] Fix Whisper.cpp on Windows --- buzz/cli.py | 1 - buzz/gui.py | 5 ++++- buzz/settings/settings.py | 3 ++- buzz/transcriber.py | 2 +- main.py | 8 +------- 5 files changed, 8 insertions(+), 11 deletions(-) diff --git a/buzz/cli.py b/buzz/cli.py index 0c9faeb30..8be7b6ad3 100644 --- a/buzz/cli.py +++ b/buzz/cli.py @@ -26,7 +26,6 @@ class CommandLineModelType(enum.Enum): def parse_command_line(app: Application): parser = QCommandLineParser() - try: parse(app, parser) except CommandLineError as exc: diff --git a/buzz/gui.py b/buzz/gui.py index ee972a606..5b53c47cb 100644 --- a/buzz/gui.py +++ b/buzz/gui.py @@ -256,7 +256,7 @@ def on_transcription_options_changed(self, transcription_options: TranscriptionO self.transcription_options = transcription_options self.word_level_timings_checkbox.setDisabled( self.transcription_options.model.model_type == ModelType.HUGGING_FACE or self.transcription_options.model.model_type == ModelType.OPEN_AI_WHISPER_API) - if self.transcription_options.openai_access_token is not None: + if self.transcription_options.openai_access_token != '': self.openai_access_token_changed.emit(self.transcription_options.openai_access_token) def on_click_run(self): @@ -1378,6 +1378,9 @@ class Application(QApplication): def __init__(self) -> None: super().__init__(sys.argv) + self.setApplicationName(APP_NAME) + self.setApplicationVersion(VERSION) + self.window = MainWindow() self.window.show() diff --git a/buzz/settings/settings.py b/buzz/settings/settings.py index db64714ae..524b01440 100644 --- a/buzz/settings/settings.py +++ b/buzz/settings/settings.py @@ -7,7 +7,8 @@ class Settings: - settings = QSettings(APP_NAME) + def __init__(self): + self.settings = QSettings(APP_NAME) class Key(enum.Enum): RECORDING_TRANSCRIBER_TASK = 'recording-transcriber/task' diff --git a/buzz/transcriber.py b/buzz/transcriber.py index ae54f28e8..12e99ae47 100644 --- a/buzz/transcriber.py +++ b/buzz/transcriber.py @@ -71,7 +71,7 @@ class TranscriptionOptions: word_level_timings: bool = False temperature: Tuple[float, ...] = DEFAULT_WHISPER_TEMPERATURE initial_prompt: str = '' - openai_access_token: Optional[str] = None + openai_access_token: str = '' @dataclass() diff --git a/main.py b/main.py index 104561353..fbf6b044f 100644 --- a/main.py +++ b/main.py @@ -8,9 +8,7 @@ from appdirs import user_log_dir -from buzz.__version__ import VERSION -from buzz.cli import parse_command_line, CommandLineError -from buzz.settings.settings import APP_NAME +from buzz.cli import parse_command_line # Check for segfaults if not running in frozen mode if getattr(sys, 'frozen', False) is False: @@ -54,9 +52,5 @@ from buzz.gui import Application app = Application() - app.setApplicationName(APP_NAME) - app.setApplicationVersion(VERSION) - parse_command_line(app) - sys.exit(app.exec())