|
| 1 | +from ...utility.strings import quote_string |
1 | 2 | from ...utility.system import get_spawn_command
|
2 | 3 | from .stt import STTHandler
|
3 | 4 | from ...handlers import ErrorSeverity, ExtraSettings
|
@@ -43,7 +44,12 @@ def get_extra_settings(self) -> list:
|
43 | 44 | "default": "tiny",
|
44 | 45 | "website": "https://github.com/openai/whisper/blob/main/model-card.md#model-details",
|
45 | 46 | },
|
46 |
| - ExtraSettings.NestedSetting("model_library", "Model Library", "Manage Whisper models", self.get_model_library()), |
| 47 | + ExtraSettings.EntrySetting("language", _("Language"), _("Language of the recognition."), "auto"), |
| 48 | + ExtraSettings.NestedSetting("model_library", _("Model Library"), _("Manage Whisper models"), self.get_model_library()), |
| 49 | + ExtraSettings.NestedSetting("advanced_settings", _("Advanced Settings"), _("More advanced settings"), [ |
| 50 | + ExtraSettings.ScaleSetting("temperature", _("Temperature"), _("Temperature to use"), 0.0, 0.0, 1.0, 2), |
| 51 | + ExtraSettings.MultilineEntrySetting("prompt", _("Prompt for the recognition"), _("Prompt to use for the recognition"), "") |
| 52 | + ]) |
47 | 53 | ]
|
48 | 54 |
|
49 | 55 | def get_model_library(self):
|
@@ -101,7 +107,7 @@ def recognize_file(self, path):
|
101 | 107 | recpath = path
|
102 | 108 | path = os.path.join(self.path, "whisper")
|
103 | 109 | exec_path = os.path.join(path, "whisper.cpp/build/bin/whisper-cli")
|
104 |
| - recognize_script = exec_path + " -f " + recpath + " -m " + os.path.join(self.path, "whisper", "whisper.cpp/models/ggml-" + self.get_setting("model") + ".bin" + " --no-prints -nt") |
| 110 | + recognize_script = exec_path + " -f " + recpath + " -m " + os.path.join(self.path, "whisper", "whisper.cpp/models/ggml-" + self.get_setting("model") + ".bin" + " --no-prints -nt -l " + self.get_setting("language") + " -tp " + str(self.get_setting("temperature")) + "--prompt" + quote_string(self.get_setting("prompt")) ) |
105 | 111 | try:
|
106 | 112 | out = subprocess.check_output(get_spawn_command() + ["bash", "-c", recognize_script])
|
107 | 113 | print(out)
|
|
0 commit comments