Skip to content

Commit

Permalink
fix: execstack
Browse files Browse the repository at this point in the history
  • Loading branch information
chidiwilliams committed Jan 5, 2024
1 parent 0f8ac9c commit a8382e7
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
7 changes: 7 additions & 0 deletions buzz/model_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,13 @@ def open_file_location(self):
return
self.open_path(path=os.path.dirname(model_path))

@staticmethod
def default():
model_type = next(
model_type for model_type in ModelType if model_type.is_available()
)
return TranscriptionModel(model_type=model_type)

@staticmethod
def open_path(path: str):
if sys.platform == "win32":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,19 @@ def save(self, settings: QSettings) -> None:
def load(cls, settings: QSettings) -> "FileTranscriptionPreferences":
language = settings.value("language", None)
task = settings.value("task", Task.TRANSCRIBE)
model = settings.value("model", TranscriptionModel())
model: TranscriptionModel = settings.value(
"model", TranscriptionModel.default()
)
word_level_timings = settings.value("word_level_timings", False)
temperature = settings.value("temperature", DEFAULT_WHISPER_TEMPERATURE)
initial_prompt = settings.value("initial_prompt", "")
output_formats = settings.value("output_formats", [])
return FileTranscriptionPreferences(
language=language,
task=task,
model=model,
model=model
if model.model_type.is_available()
else TranscriptionModel.default(),
word_level_timings=word_level_timings,
temperature=temperature,
initial_prompt=initial_prompt,
Expand Down
1 change: 1 addition & 0 deletions buzz/widgets/transcriber/file_transcriber_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def __init__(
self.file_paths = file_paths

preferences = self.load_preferences()
print(preferences)

(
self.transcription_options,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def test_edit_folder_watch_preferences(self, qtbot):
file_transcription_options=FileTranscriptionPreferences(
language=None,
task=Task.TRANSCRIBE,
model=TranscriptionModel(),
model=TranscriptionModel.default(),
word_level_timings=False,
temperature=DEFAULT_WHISPER_TEMPERATURE,
initial_prompt="",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,7 @@ def downloaded_model():

@pytest.fixture(scope="class")
def default_model_path(self) -> str:
model_type = next(
model_type for model_type in ModelType if model_type.is_available()
)
model = TranscriptionModel(model_type=model_type)
return get_model_path(transcription_model=model)
return get_model_path(transcription_model=(TranscriptionModel.default()))

def test_should_show_downloaded_model(self, qtbot, default_model_path):
widget = ModelsPreferencesWidget()
Expand Down

0 comments on commit a8382e7

Please sign in to comment.