From 7746cffb0870c8eb4a165df0e03ee3116d49fb34 Mon Sep 17 00:00:00 2001 From: misyaguziya <53165965+misyaguziya@users.noreply.github.com> Date: Sat, 8 Feb 2025 14:29:02 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=8D=EF=B8=8F[Update]=20Controller=20:?= =?UTF-8?q?=20AI=E3=83=A2=E3=83=87=E3=83=AB=E3=81=8C=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E5=8F=AF=E8=83=BD=E3=81=8B=E3=82=92=E9=80=9A=E7=9F=A5=E3=81=99?= =?UTF-8?q?=E3=82=8B=E3=82=A8=E3=83=B3=E3=83=89=E3=83=9D=E3=82=A4=E3=83=B3?= =?UTF-8?q?=E3=83=88=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src-python/controller.py | 20 ++++++++++++++++++++ src-python/mainloop.py | 1 + 2 files changed, 21 insertions(+) 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",