diff --git a/src-python/controller.py b/src-python/controller.py index bc57ae1d..8fb05825 100644 --- a/src-python/controller.py +++ b/src-python/controller.py @@ -39,6 +39,20 @@ class Controller: False, ) + def enableAiModels(self) -> None: + self.run( + 200, + self.run_mapping["enable_ai_models"], + True, + ) + + def disableAiModels(self) -> None: + self.run( + 200, + self.run_mapping["enable_ai_models"], + False, + ) + def updateMicHostList(self) -> None: self.run( 200, @@ -1754,6 +1768,12 @@ class Controller: if isinstance(th_download_whisper, Thread): th_download_whisper.join() + if (model.checkTranslatorCTranslate2ModelWeight(config.CTRANSLATE2_WEIGHT_TYPE) is False or + model.checkTranscriptionWhisperModelWeight(config.WHISPER_WEIGHT_TYPE) is False): + self.disableAiModels() + else: + self.enableAiModels() + for engine in config.SELECTABLE_TRANSLATION_ENGINE_LIST: match engine: case "CTranslate2": diff --git a/src-python/mainloop.py b/src-python/mainloop.py index 67b5e36b..e2dabbfc 100644 --- a/src-python/mainloop.py +++ b/src-python/mainloop.py @@ -9,6 +9,7 @@ from utils import printLog, printResponse, errorLogging, encodeBase64 run_mapping = { "connected_network":"/run/connected_network", + "enable_ai_models":"/run/enable_ai_models", "transcription_mic":"/run/transcription_send_mic_message", "transcription_speaker":"/run/transcription_receive_speaker_message",