From 7fd3fad3ea31f90aa3d7bfeb2d4361300aefa17d Mon Sep 17 00:00:00 2001 From: misyaguziya <53165965+misyaguziya@users.noreply.github.com> Date: Tue, 29 Oct 2024 22:58:18 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=8D=EF=B8=8F[Update]=20Model=20:=20AI?= =?UTF-8?q?=20=E3=83=A2=E3=83=87=E3=83=AB=E3=81=AE=E3=83=80=E3=82=A6?= =?UTF-8?q?=E3=83=B3=E3=83=AD=E3=83=BC=E3=83=89=E6=96=B9=E6=B3=95=E3=82=92?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - AIモデルのダウンロード済み確認辞書を追加 - selectable_ctranslate2_weight_type_dict - selectable_whisper_weight_type_dict - AIモデルダウンロード処理完了のエンドポイントを追加 - /run/download_ctranslate2_weight - /run/downloaded_whisper_weight --- src-python/config.py | 55 +++--- src-python/model.py | 16 +- .../transcription/transcription_whisper.py | 35 ++-- .../models/translation/translation_utils.py | 40 ++-- src-python/webui_controller.py | 187 +++++++++++++----- src-python/webui_mainloop.py | 11 +- 6 files changed, 228 insertions(+), 116 deletions(-) diff --git a/src-python/config.py b/src-python/config.py index 9045a690..009749fb 100644 --- a/src-python/config.py +++ b/src-python/config.py @@ -98,14 +98,6 @@ class Config: def MESSAGE_BOX_RATIO_RANGE(self): return self._MESSAGE_BOX_RATIO_RANGE - @property - def SELECTABLE_CTRANSLATE2_WEIGHT_TYPE_LIST(self): - return self._SELECTABLE_CTRANSLATE2_WEIGHT_TYPE_LIST - - @property - def SELECTABLE_WHISPER_WEIGHT_TYPE_LIST(self): - return self._SELECTABLE_WHISPER_WEIGHT_TYPE_LIST - @property def MAX_MIC_THRESHOLD(self): return self._MAX_MIC_THRESHOLD @@ -177,6 +169,24 @@ class Config: if isinstance(value, bool): self._ENABLE_CHECK_ENERGY_RECEIVE = value + @property + def SELECTABLE_CTRANSLATE2_WEIGHT_TYPE_DICT(self): + return self._SELECTABLE_CTRANSLATE2_WEIGHT_TYPE_DICT + + @SELECTABLE_CTRANSLATE2_WEIGHT_TYPE_DICT.setter + def SELECTABLE_CTRANSLATE2_WEIGHT_TYPE_DICT(self, value): + if isinstance(value, dict): + self._SELECTABLE_CTRANSLATE2_WEIGHT_TYPE_DICT = value + + @property + def SELECTABLE_WHISPER_WEIGHT_TYPE_DICT(self): + return self._SELECTABLE_WHISPER_WEIGHT_TYPE_DICT + + @SELECTABLE_WHISPER_WEIGHT_TYPE_DICT.setter + def SELECTABLE_WHISPER_WEIGHT_TYPE_DICT(self, value): + if isinstance(value, dict): + self._SELECTABLE_WHISPER_WEIGHT_TYPE_DICT = value + # Save Json Data ## Main Window @property @@ -252,7 +262,7 @@ class Config: def SELECTED_TRANSCRIPTION_ENGINE(self, value): if isinstance(value, str): self._SELECTED_TRANSCRIPTION_ENGINE = value - # self.saveConfig(inspect.currentframe().f_code.co_name, value) + self.saveConfig(inspect.currentframe().f_code.co_name, value) @property @json_serializable('MULTI_LANGUAGE_TRANSLATION') @@ -706,7 +716,6 @@ class Config: @CTRANSLATE2_WEIGHT_TYPE.setter def CTRANSLATE2_WEIGHT_TYPE(self, value): - # if isinstance(value, str) and value in self.SELECTABLE_CTRANSLATE2_WEIGHT_TYPE_LIST: if isinstance(value, str): self._CTRANSLATE2_WEIGHT_TYPE = value self.saveConfig(inspect.currentframe().f_code.co_name, value) @@ -924,20 +933,20 @@ class Config: self._UI_SCALING_RANGE = (40, 200) self._TEXTBOX_UI_SCALING_RANGE = (40, 200) self._MESSAGE_BOX_RATIO_RANGE = (1, 99) - self._SELECTABLE_CTRANSLATE2_WEIGHT_TYPE_LIST = [ - "Small", - "Large", - ] + self._SELECTABLE_CTRANSLATE2_WEIGHT_TYPE_DICT = { + "Small": False, + "Large": False, + } - self._SELECTABLE_WHISPER_WEIGHT_TYPE_LIST = [ - "tiny", - "base", - "small", - "medium", - "large-v1", - "large-v2", - "large-v3", - ] + self._SELECTABLE_WHISPER_WEIGHT_TYPE_DICT = { + "tiny": False, + "base": False, + "small": False, + "medium": False, + "large-v1": False, + "large-v2": False, + "large-v3": False, + } self._MAX_MIC_THRESHOLD = 2000 self._MAX_SPEAKER_THRESHOLD = 4000 diff --git a/src-python/model.py b/src-python/model.py index 589ec0fa..7408d4f2 100644 --- a/src-python/model.py +++ b/src-python/model.py @@ -101,8 +101,8 @@ class Model: self.kks = kakasi() self.watchdog = Watchdog(config.WATCHDOG_TIMEOUT, config.WATCHDOG_INTERVAL) - def checkCTranslatorCTranslate2ModelWeight(self): - return checkCTranslate2Weight(config.PATH_LOCAL, config.CTRANSLATE2_WEIGHT_TYPE) + def checkTranslatorCTranslate2ModelWeight(self, weight_type:str): + return checkCTranslate2Weight(config.PATH_LOCAL, weight_type) def changeTranslatorCTranslate2Model(self): self.translator.changeCTranslate2Model( @@ -111,17 +111,17 @@ class Model: config.SELECTED_TRANSLATION_COMPUTE_DEVICE["device"], config.SELECTED_TRANSLATION_COMPUTE_DEVICE["device_index"]) - def downloadCTranslate2ModelWeight(self, callbackFunc=None): - return downloadCTranslate2Weight(config.PATH_LOCAL, config.CTRANSLATE2_WEIGHT_TYPE, callbackFunc) + def downloadCTranslate2ModelWeight(self, weight_type, callback=None, end_callback=None): + return downloadCTranslate2Weight(config.PATH_LOCAL, weight_type, callback, end_callback) def isLoadedCTranslate2Model(self): return self.translator.isLoadedCTranslate2Model() - def checkTranscriptionWhisperModelWeight(self): - return checkWhisperWeight(config.PATH_LOCAL, config.WHISPER_WEIGHT_TYPE) + def checkTranscriptionWhisperModelWeight(self, weight_type:str): + return checkWhisperWeight(config.PATH_LOCAL, weight_type) - def downloadWhisperModelWeight(self, callbackFunc=None): - return downloadWhisperWeight(config.PATH_LOCAL, config.WHISPER_WEIGHT_TYPE, callbackFunc) + def downloadWhisperModelWeight(self, weight_type, callback=None, end_callback=None): + return downloadWhisperWeight(config.PATH_LOCAL, weight_type, callback, end_callback) def resetKeywordProcessor(self): del self.keyword_processor diff --git a/src-python/models/transcription/transcription_whisper.py b/src-python/models/transcription/transcription_whisper.py index 398a7524..d21df91a 100644 --- a/src-python/models/transcription/transcription_whisper.py +++ b/src-python/models/transcription/transcription_whisper.py @@ -63,17 +63,16 @@ def checkWhisperWeight(root, weight_type): pass return result -def downloadWhisperWeight(root, weight_type, callbackFunc): +def downloadWhisperWeight(root, weight_type, callback=None, end_callback=None): path = os_path.join(root, "weights", "whisper", weight_type) os_makedirs(path, exist_ok=True) - if checkWhisperWeight(root, weight_type) is True: - callbackFunc(1) - return - - for filename in _FILENAMES: - file_path = os_path.join(path, filename) - url = huggingface_hub.hf_hub_url(_MODELS[weight_type], filename) - downloadFile(url, file_path, func=callbackFunc) + if checkWhisperWeight(root, weight_type) is False: + for filename in _FILENAMES: + file_path = os_path.join(path, filename) + url = huggingface_hub.hf_hub_url(_MODELS[weight_type], filename) + downloadFile(url, file_path, func=callback) + if isinstance(end_callback, Callable): + end_callback() def getWhisperModel(root, weight_type, device="cpu", device_index=0): path = os_path.join(root, "weights", "whisper", weight_type) @@ -93,10 +92,14 @@ if __name__ == "__main__": print(value) pass - downloadWhisperWeight("./", "tiny", callback) - downloadWhisperWeight("./", "base", callback) - downloadWhisperWeight("./", "small", callback) - downloadWhisperWeight("./", "medium", callback) - downloadWhisperWeight("./", "large-v1", callback) - downloadWhisperWeight("./", "large-v2", callback) - downloadWhisperWeight("./", "large-v3", callback) \ No newline at end of file + def end_callback(): + print("end") + pass + + downloadWhisperWeight("./", "tiny", callback, end_callback) + downloadWhisperWeight("./", "base", callback, end_callback) + downloadWhisperWeight("./", "small", callback, end_callback) + downloadWhisperWeight("./", "medium", callback, end_callback) + downloadWhisperWeight("./", "large-v1", callback, end_callback) + downloadWhisperWeight("./", "large-v2", callback, end_callback) + downloadWhisperWeight("./", "large-v3", callback, end_callback) \ No newline at end of file diff --git a/src-python/models/translation/translation_utils.py b/src-python/models/translation/translation_utils.py index aa6437da..ca0eddc7 100644 --- a/src-python/models/translation/translation_utils.py +++ b/src-python/models/translation/translation_utils.py @@ -60,30 +60,30 @@ def checkCTranslate2Weight(path, weight_type="Small"): already_downloaded = True return already_downloaded -def downloadCTranslate2Weight(root, weight_type="Small", callbackFunc=None): +def downloadCTranslate2Weight(root, weight_type="Small", callback=None, end_callback=None): url = ctranslate2_weights[weight_type]["url"] filename = "weight.zip" path = os_path.join(root, "weights", "ctranslate2") os_makedirs(path, exist_ok=True) - if checkCTranslate2Weight(path, weight_type): - callbackFunc(1) - return + if checkCTranslate2Weight(path, weight_type) is False: + try: + with tempfile.TemporaryDirectory() as tmp_path: + res = requests_get(url, stream=True) + file_size = int(res.headers.get('content-length', 0)) + total_chunk = 0 + with open(os_path.join(tmp_path, filename), 'wb') as file: + for chunk in res.iter_content(chunk_size=1024*2000): + file.write(chunk) + if isinstance(callback, Callable): + total_chunk += len(chunk) + callback(total_chunk/file_size) + printLog(f"Downloading CTranslate Model: {total_chunk/file_size:.0%}") - try: - with tempfile.TemporaryDirectory() as tmp_path: - res = requests_get(url, stream=True) - file_size = int(res.headers.get('content-length', 0)) - total_chunk = 0 - with open(os_path.join(tmp_path, filename), 'wb') as file: - for chunk in res.iter_content(chunk_size=1024*2000): - file.write(chunk) - if isinstance(callbackFunc, Callable): - total_chunk += len(chunk) - callbackFunc(total_chunk/file_size) - printLog(f"Downloading CTranslate Model: {total_chunk/file_size:.0%}") + with ZipFile(os_path.join(tmp_path, filename)) as zf: + zf.extractall(path) + except Exception as e: + printLog("warning:downloadCTranslate2Weight()", e) - with ZipFile(os_path.join(tmp_path, filename)) as zf: - zf.extractall(path) - except Exception as e: - printLog("warning:downloadCTranslate2Weight()", e) \ No newline at end of file + if isinstance(end_callback, Callable): + end_callback() \ No newline at end of file diff --git a/src-python/webui_controller.py b/src-python/webui_controller.py index d20790b2..0cccba25 100644 --- a/src-python/webui_controller.py +++ b/src-python/webui_controller.py @@ -134,21 +134,55 @@ class Controller: energy, ) - def downloadCTranslate2ProgressBar(self, progress) -> None: - printLog("CTranslate2 Weight Download Progress", progress) - self.run( - 200, - self.run_mapping["download_ctranslate2"], - progress, - ) + class DownloadCTranslate2: + def __init__(self, run_mapping:dict, weight_type:str, run:Callable[[int, str, Any], None]) -> None: + self.run_mapping = run_mapping + self.weight_type = weight_type + self.run = run - def downloadWhisperProgressBar(self, progress) -> None: - printLog("Whisper Weight Download Progress", progress) - self.run( - 200, - self.run_mapping["download_whisper"], - progress, - ) + def progressBar(self, progress) -> None: + printLog("CTranslate2 Weight Download Progress", progress) + self.run( + 200, + self.run_mapping["download_ctranslate2_weight"], + {"weight_type": self.weight_type, "progress": progress}, + ) + + def downloaded(self) -> None: + weight_type_dict = config.SELECTABLE_CTRANSLATE2_WEIGHT_TYPE_DICT + weight_type_dict["self.weight_type"] = True + config.SELECTABLE_CTRANSLATE2_WEIGHT_TYPE_DICT = weight_type_dict + + self.run( + 200, + self.run_mapping["downloaded_ctranslate2_weight"], + self.weight_type, + ) + + class DownloadWhisper: + def __init__(self, run_mapping:dict, weight_type:str, run:Callable[[int, str, Any], None]) -> None: + self.run_mapping = run_mapping + self.weight_type = weight_type + self.run = run + + def progressBar(self, progress) -> None: + printLog("Whisper Weight Download Progress", progress) + self.run( + 200, + self.run_mapping["download_whisper_weight"], + {"weight_type": self.weight_type, "progress": progress}, + ) + + def downloaded(self) -> None: + weight_type_dict = config.SELECTABLE_WHISPER_WEIGHT_TYPE_DICT + weight_type_dict[self.weight_type] = True + config.SELECTABLE_WHISPER_WEIGHT_TYPE_DICT = weight_type_dict + + self.run( + 200, + self.run_mapping["downloaded_whisper_weight"], + self.weight_type, + ) def micMessage(self, message: Union[str, bool]) -> None: if isinstance(message, bool) and message is False: @@ -397,8 +431,8 @@ class Controller: return {"status":200,"result":config.SELECTED_TRANSLATION_COMPUTE_DEVICE} @staticmethod - def getSelectableCtranslate2WeightTypeList(*args, **kwargs) -> dict: - return {"status":200, "result":config.SELECTABLE_CTRANSLATE2_WEIGHT_TYPE_LIST} + def getSelectableCtranslate2WeightTypeDict(*args, **kwargs) -> dict: + return {"status":200, "result":config.SELECTABLE_CTRANSLATE2_WEIGHT_TYPE_DICT} @staticmethod def getSelectedTranscriptionComputeDevice(*args, **kwargs) -> dict: @@ -411,8 +445,8 @@ class Controller: return {"status":200,"result":config.SELECTED_TRANSCRIPTION_COMPUTE_DEVICE} @staticmethod - def getSelectableWhisperWeightTypeList(*args, **kwargs) -> dict: - return {"status":200, "result":config.SELECTABLE_WHISPER_WEIGHT_TYPE_LIST} + def getSelectableWhisperWeightTypeDict(*args, **kwargs) -> dict: + return {"status":200, "result":config.SELECTABLE_WHISPER_WEIGHT_TYPE_DICT} @staticmethod def getMaxMicThreshold(*args, **kwargs) -> dict: @@ -511,6 +545,24 @@ class Controller: def getSelectedTranscriptionEngine(*args, **kwargs) -> dict: return {"status":200, "result":config.SELECTED_TRANSCRIPTION_ENGINE} + @staticmethod + def setSelectedTranscriptionEngine(data, *args, **kwargs) -> dict: + engine = data["engine"] + weight_type = data["weight_type"] + if engine == "Whisper" and config.SELECTABLE_WHISPER_WEIGHT_TYPE_DICT[weight_type] is False: + config.SELECTED_TRANSCRIPTION_ENGINE = "Google" + config.WHISPER_WEIGHT_TYPE = None + else: + config.SELECTED_TRANSCRIPTION_ENGINE = engine + config.WHISPER_WEIGHT_TYPE = weight_type + return { + "status":200, + "result":{ + "engine": config.SELECTED_TRANSCRIPTION_ENGINE, + "weight_type": config.WHISPER_WEIGHT_TYPE, + } + } + @staticmethod def getMultiLanguageTranslation(*args, **kwargs) -> dict: return {"status":200, "result":config.MULTI_LANGUAGE_TRANSLATION} @@ -1079,7 +1131,7 @@ class Controller: @staticmethod def setEnableUseTranslationFeature(*args, **kwargs) -> dict: config.USE_TRANSLATION_FEATURE = True - if model.checkCTranslatorCTranslate2ModelWeight(): + if model.checkTranslatorCTranslate2ModelWeight(config.CTRANSLATE2_WEIGHT_TYPE): def callback(): model.changeTranslatorCTranslate2Model() th_callback = Thread(target=callback) @@ -1099,7 +1151,7 @@ class Controller: @staticmethod def setCtranslate2WeightType(data, *args, **kwargs) -> dict: config.CTRANSLATE2_WEIGHT_TYPE = str(data) - if model.checkCTranslatorCTranslate2ModelWeight(): + if model.checkTranslatorCTranslate2ModelWeight(config.CTRANSLATE2_WEIGHT_TYPE): def callback(): model.changeTranslatorCTranslate2Model() th_callback = Thread(target=callback) @@ -1114,16 +1166,7 @@ class Controller: @staticmethod def setWhisperWeightType(data, *args, **kwargs) -> dict: config.WHISPER_WEIGHT_TYPE = str(data) - if model.checkTranscriptionWhisperModelWeight() is True: - config.SELECTED_TRANSCRIPTION_ENGINE = "Whisper" - else: - config.SELECTED_TRANSCRIPTION_ENGINE = "Google" - return {"status":200, - "result":{ - "weight_type":config.WHISPER_WEIGHT_TYPE, - "transcription_engine":config.SELECTED_TRANSCRIPTION_ENGINE, - } - } + return {"status":200, "result": config.WHISPER_WEIGHT_TYPE} @staticmethod def getAutoClearMessageBox(*args, **kwargs) -> dict: @@ -1410,12 +1453,33 @@ class Controller: th_start_update_software.start() return {"status":200, "result":True} - def downloadCtranslate2Weight(self, *args, **kwargs) -> dict: - self.startThreadingDownloadCtranslate2Weight(self.downloadCTranslate2ProgressBar) + def downloadCtranslate2Weight(self, data:str, *args, **kwargs) -> dict: + weight_type = str(data) + download_ctranslate2 = self.DownloadCTranslate2( + self.run_mapping, + weight_type, + self.run + ) + + self.startThreadingDownloadCtranslate2Weight( + weight_type, + download_ctranslate2.progressBar, + download_ctranslate2.downloaded, + ) return {"status":200, "result":True} - def downloadWhisperWeight(self, *args, **kwargs) -> dict: - self.startThreadingDownloadWhisperWeight(self.downloadWhisperProgressBar) + def downloadWhisperWeight(self, data:str, *args, **kwargs) -> dict: + weight_type = str(data) + download_whisper = self.DownloadWhisper( + self.run_mapping, + weight_type, + self.run + ) + self.startThreadingDownloadWhisperWeight( + weight_type, + download_whisper.progressBar, + download_whisper.downloaded, + ) return {"status":200, "result":True} @staticmethod @@ -1524,14 +1588,35 @@ class Controller: cleaned_text = re.sub(pattern, r'\1', text) return cleaned_text + def updateDownloadedCTranslate2ModelWeight(self) -> None: + weight_type_dict = config.SELECTABLE_CTRANSLATE2_WEIGHT_TYPE_DICT + for weight_type in weight_type_dict.keys(): + weight_type_dict[weight_type] = model.checkTranslatorCTranslate2ModelWeight(weight_type) + config.SELECTABLE_CTRANSLATE2_WEIGHT_TYPE_DICT = weight_type_dict + def updateTranslationEngineAndEngineList(self): - engine = config.SELECTED_TRANSLATION_ENGINES[config.SELECTED_TAB_NO] - engines = self.getTranslationEngines()["result"] - if engine not in engines: + engines = config.SELECTED_TRANSLATION_ENGINES + engine = engines[config.SELECTED_TAB_NO] + selectable_engines = self.getTranslationEngines()["result"] + if engine not in selectable_engines: engine = "CTranslate2" - config.SELECTED_TRANSLATION_ENGINES[config.SELECTED_TAB_NO] = engine + engines[config.SELECTED_TAB_NO] = engine + config.SELECTED_TRANSLATION_ENGINES = engines + self.run(200, self.run_mapping["selected_translation_engines"], config.SELECTED_TRANSLATION_ENGINES) - self.run(200, self.run_mapping["translation_engines"], engines) + self.run(200, self.run_mapping["translation_engines"], selectable_engines) + + def updateDownloadedWhisperModelWeight(self) -> None: + weight_type_dict = config.SELECTABLE_WHISPER_WEIGHT_TYPE_DICT + for weight_type in weight_type_dict.keys(): + weight_type_dict[weight_type] = model.checkTranscriptionWhisperModelWeight(weight_type) + config.SELECTABLE_WHISPER_WEIGHT_TYPE_DICT = weight_type_dict + + def updateTranscriptionEngine(self): + weight_type_dict = config.SELECTABLE_WHISPER_WEIGHT_TYPE_DICT + weight_type = config.WHISPER_WEIGHT_TYPE + if config.SELECTED_TRANSCRIPTION_ENGINE == "Whisper" and weight_type_dict[weight_type] is False: + config.SELECTED_TRANSCRIPTION_ENGINE = "Google" def startCheckMicEnergy(self) -> None: while self.device_access_status is False: @@ -1576,14 +1661,14 @@ class Controller: th_stopCheckSpeakerEnergy.join() @staticmethod - def startThreadingDownloadCtranslate2Weight(callback:Callable[[float], None]) -> None: - th_download = Thread(target=model.downloadCTranslate2ModelWeight, args=(callback,)) + def startThreadingDownloadCtranslate2Weight(weight_type:str, callback:Callable[[float], None], end_callback:Callable[[float], None]) -> None: + th_download = Thread(target=model.downloadCTranslate2ModelWeight, args=(weight_type, callback, end_callback)) th_download.daemon = True th_download.start() @staticmethod - def startThreadingDownloadWhisperWeight(callback:Callable[[float], None]) -> None: - th_download = Thread(target=model.downloadWhisperModelWeight, args=(callback,)) + def startThreadingDownloadWhisperWeight(weight_type:str, callback:Callable[[float], None], end_callback:Callable[[float], None]) -> None: + th_download = Thread(target=model.downloadWhisperModelWeight, args=(weight_type, callback, end_callback)) th_download.daemon = True th_download.start() @@ -1619,11 +1704,23 @@ class Controller: # set Translation Engine printLog("Set Translation Engine") + self.updateDownloadedCTranslate2ModelWeight() self.updateTranslationEngineAndEngineList() + # download CTranslate2 Model Weight + printLog("Download CTranslate2 Model Weight") + if config.USE_TRANSLATION_FEATURE is True and model.checkTranslatorCTranslate2ModelWeight(config.CTRANSLATE2_WEIGHT_TYPE) is False: + self.downloadCtranslate2Weight(config.CTRANSLATE2_WEIGHT_TYPE) + # set Transcription Engine - # printLog("Set Transcription Engine") - # self.updateTranscriptionEngineAndEngineList() + printLog("Set Transcription Engine") + self.updateDownloadedWhisperModelWeight() + self.updateTranscriptionEngine() + + # download Whisper Model Weight + printLog("Download Whisper Model Weight") + if model.checkTranscriptionWhisperModelWeight(config.WHISPER_WEIGHT_TYPE) is False: + self.downloadWhisperWeight(config.WHISPER_WEIGHT_TYPE) # set word filter printLog("Set Word Filter") diff --git a/src-python/webui_mainloop.py b/src-python/webui_mainloop.py index 54671c62..2f892dd8 100644 --- a/src-python/webui_mainloop.py +++ b/src-python/webui_mainloop.py @@ -20,8 +20,10 @@ run_mapping = { "error_translation_engine":"/run/error_translation_engine", "word_filter":"/run/word_filter", - "download_ctranslate2":"/run/download_ctranslate2_weight", - "download_whisper":"/run/download_whisper_weight", + "download_ctranslate2_weight":"/run/download_ctranslate2_weight", + "downloaded_ctranslate2_weight":"/run/download_ctranslate2_weight", + "download_whisper_weight":"/run/download_whisper_weight", + "downloaded_whisper_weight":"/run/downloaded_whisper_weight", "selected_mic_device":"/run/selected_mic_device", "selected_speaker_device":"/run/selected_speaker_device", @@ -79,6 +81,7 @@ mapping = { "/set/data/selected_target_languages": {"status": True, "variable":controller.setSelectedTargetLanguages}, "/get/data/selected_transcription_engine": {"status": False, "variable":controller.getSelectedTranscriptionEngine}, + "/set/data/selected_transcription_engine": {"status": False, "variable":controller.setSelectedTranscriptionEngine}, "/run/send_message_box": {"status": False, "variable":controller.sendMessageBox}, "/run/typing_message_box": {"status": False, "variable":controller.typingMessageBox}, @@ -136,7 +139,7 @@ mapping = { "/get/data/selected_translation_compute_device": {"status": True, "variable":controller.getSelectedTranslationComputeDevice}, "/set/data/selected_translation_compute_device": {"status": True, "variable":controller.setSelectedTranslationComputeDevice}, - "/get/data/selectable_ctranslate2_weight_type_list": {"status": True, "variable":controller.getSelectableCtranslate2WeightTypeList}, + "/get/data/selectable_ctranslate2_weight_type_dict": {"status": True, "variable":controller.getSelectableCtranslate2WeightTypeDict}, "/get/data/ctranslate2_weight_type": {"status": True, "variable":controller.getCtranslate2WeightType}, "/set/data/ctranslate2_weight_type": {"status": True, "variable":controller.setCtranslate2WeightType}, @@ -241,7 +244,7 @@ mapping = { "/get/data/selected_transcription_compute_device": {"status": True, "variable":controller.getSelectedTranscriptionComputeDevice}, "/set/data/selected_transcription_compute_device": {"status": True, "variable":controller.setSelectedTranscriptionComputeDevice}, - "/get/data/selectable_whisper_weight_type_list": {"status": True, "variable":controller.getSelectableWhisperWeightTypeList}, + "/get/data/selectable_whisper_weight_type_dict": {"status": True, "variable":controller.getSelectableWhisperWeightTypeDict}, "/get/data/whisper_weight_type": {"status": True, "variable":controller.getWhisperWeightType}, "/set/data/whisper_weight_type": {"status": True, "variable":controller.setWhisperWeightType},