From 1b1a2773a1302ddac3328b93daf531d90436dcad Mon Sep 17 00:00:00 2001 From: misyaguziya <53165965+misyaguziya@users.noreply.github.com> Date: Thu, 21 Nov 2024 23:36:04 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=8D=EF=B8=8F[Update]=20Controller=20:?= =?UTF-8?q?=20add=20init=20progress?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src-python/webui_controller.py | 17 ++++++++++++++--- src-python/webui_mainloop.py | 1 + 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src-python/webui_controller.py b/src-python/webui_controller.py index 3c83b626..000dd09e 100644 --- a/src-python/webui_controller.py +++ b/src-python/webui_controller.py @@ -1679,9 +1679,12 @@ class Controller: model.stopWatchdog() return {"status":200, "result":True} + def initializationProgress(self, progress): + self.run(200, self.run_mapping["initialization_progress"], progress) + def init(self, *args, **kwargs) -> None: - removeLog() printLog("Start Initialization") + removeLog() printLog("Start check DeepL API Key") if config.AUTH_KEYS["DeepL_API"] is not None: @@ -1691,6 +1694,8 @@ class Controller: auth_keys["DeepL_API"] = None config.AUTH_KEYS = auth_keys + self.initializationProgress(1) + # download CTranslate2 Model Weight printLog("Download CTranslate2 Model Weight") weight_type = config.CTRANSLATE2_WEIGHT_TYPE @@ -1714,6 +1719,8 @@ class Controller: if isinstance(th_download_whisper, Thread): th_download_whisper.join() + self.initializationProgress(2) + # set Translation Engine printLog("Set Translation Engine") self.updateDownloadedCTranslate2ModelWeight() @@ -1724,6 +1731,8 @@ class Controller: self.updateDownloadedWhisperModelWeight() self.updateTranscriptionEngine() + self.initializationProgress(3) + # set Compute CPU or CUDA printLog("Set Compute CPU or CUDA") self.updateComputeDeviceSettings() @@ -1748,6 +1757,7 @@ class Controller: self.setEnableVrcMicMuteSync() # init Auto device selection + printLog("Init Device Manager") device_manager.setCallbackHostList(self.updateMicHostList) device_manager.setCallbackMicDeviceList(self.updateMicDeviceList) device_manager.setCallbackSpeakerDeviceList(self.updateSpeakerDeviceList) @@ -1755,7 +1765,6 @@ class Controller: printLog("Init Auto Device Selection") if config.AUTO_MIC_SELECT is True: self.setEnableAutoMicSelect() - if config.AUTO_SPEAKER_SELECT is True: self.setEnableAutoSpeakerSelect() @@ -1763,8 +1772,10 @@ class Controller: if (config.OVERLAY_SMALL_LOG is True or config.OVERLAY_LARGE_LOG is True): model.startOverlay() + self.initializationProgress(4) + + printLog("Update settings") self.updateConfigSettings() printLog("End Initialization") - self.startWatchdog() \ No newline at end of file diff --git a/src-python/webui_mainloop.py b/src-python/webui_mainloop.py index 994ad941..e90a9ee5 100644 --- a/src-python/webui_mainloop.py +++ b/src-python/webui_mainloop.py @@ -37,6 +37,7 @@ run_mapping = { "update_software_flag":"/run/update_software_flag", + "initialization_progress":"/run/initialization_progress", "initialization_complete":"/run/initialization_complete", }