👍️[Update] Main : 以下のエンドポイントを元に戻した
- /get/data/ctranslate2_weight_type - /set/data/ctranslate2_weight_type - /get/data/whisper_weight_type - /set/data/whisper_weight_type
This commit is contained in:
@@ -118,8 +118,6 @@ class Model:
|
||||
return self.translator.isLoadedCTranslate2Model()
|
||||
|
||||
def checkTranscriptionWhisperModelWeight(self, weight_type:str):
|
||||
if weight_type == "none":
|
||||
return True
|
||||
return checkWhisperWeight(config.PATH_LOCAL, weight_type)
|
||||
|
||||
def downloadWhisperModelWeight(self, weight_type, callback=None, end_callback=None):
|
||||
@@ -429,7 +427,7 @@ class Model:
|
||||
max_phrases=config.MIC_MAX_PHRASES,
|
||||
transcription_engine=config.SELECTED_TRANSCRIPTION_ENGINE,
|
||||
root=config.PATH_LOCAL,
|
||||
whisper_weight_type=config.WHISPER_WEIGHT_TYPE if config.WHISPER_WEIGHT_TYPE != "none" else None,
|
||||
whisper_weight_type=config.WHISPER_WEIGHT_TYPE,
|
||||
device=config.SELECTED_TRANSCRIPTION_COMPUTE_DEVICE["device"],
|
||||
device_index=config.SELECTED_TRANSCRIPTION_COMPUTE_DEVICE["device_index"],
|
||||
)
|
||||
@@ -593,7 +591,7 @@ class Model:
|
||||
max_phrases=config.SPEAKER_MAX_PHRASES,
|
||||
transcription_engine=config.SELECTED_TRANSCRIPTION_ENGINE,
|
||||
root=config.PATH_LOCAL,
|
||||
whisper_weight_type=config.WHISPER_WEIGHT_TYPE if config.WHISPER_WEIGHT_TYPE != "none" else None,
|
||||
whisper_weight_type=config.WHISPER_WEIGHT_TYPE,
|
||||
device=config.SELECTED_TRANSCRIPTION_COMPUTE_DEVICE["device"],
|
||||
device_index=config.SELECTED_TRANSCRIPTION_COMPUTE_DEVICE["device_index"],
|
||||
)
|
||||
|
||||
@@ -514,33 +514,12 @@ class Controller:
|
||||
|
||||
@staticmethod
|
||||
def getSelectedTranslationEngines(*args, **kwargs) -> dict:
|
||||
data = {
|
||||
"engines":config.SELECTED_TRANSLATION_ENGINES,
|
||||
"weight_type":config.CTRANSLATE2_WEIGHT_TYPE,
|
||||
}
|
||||
return {"status":200, "result":data}
|
||||
return {"status":200, "result":config.SELECTED_TRANSLATION_ENGINES}
|
||||
|
||||
@staticmethod
|
||||
def setSelectedTranslationEngines(data:dict, *args, **kwargs) -> dict:
|
||||
config.SELECTED_TRANSLATION_ENGINES = data.get("engines", {
|
||||
"1":"CTranslate2",
|
||||
"2":"CTranslate2",
|
||||
"3":"CTranslate2",
|
||||
})
|
||||
config.CTRANSLATE2_WEIGHT_TYPE = data.get("weight_type", "small")
|
||||
|
||||
if model.checkTranslatorCTranslate2ModelWeight(config.CTRANSLATE2_WEIGHT_TYPE):
|
||||
def callback():
|
||||
model.changeTranslatorCTranslate2Model()
|
||||
th_callback = Thread(target=callback)
|
||||
th_callback.daemon = True
|
||||
th_callback.start()
|
||||
|
||||
data = {
|
||||
"engines":config.SELECTED_TRANSLATION_ENGINES,
|
||||
"weight_type":config.CTRANSLATE2_WEIGHT_TYPE,
|
||||
}
|
||||
return {"status":200,"result":data}
|
||||
config.SELECTED_TRANSLATION_ENGINES = data
|
||||
return {"status":200,"result":config.SELECTED_TRANSLATION_ENGINES}
|
||||
|
||||
@staticmethod
|
||||
def getSelectedYourLanguages(*args, **kwargs) -> dict:
|
||||
@@ -562,21 +541,12 @@ class Controller:
|
||||
|
||||
@staticmethod
|
||||
def getSelectedTranscriptionEngine(*args, **kwargs) -> dict:
|
||||
data = {
|
||||
"engine":config.SELECTED_TRANSCRIPTION_ENGINE,
|
||||
"weight_type":config.WHISPER_WEIGHT_TYPE,
|
||||
}
|
||||
return {"status":200, "result":data}
|
||||
return {"status":200, "result":config.SELECTED_TRANSCRIPTION_ENGINE}
|
||||
|
||||
@staticmethod
|
||||
def setSelectedTranscriptionEngine(data:dict, *args, **kwargs) -> dict:
|
||||
config.SELECTED_TRANSCRIPTION_ENGINE = data["engine"]
|
||||
config.WHISPER_WEIGHT_TYPE = data["weight_type"]
|
||||
data = {
|
||||
"engine":config.SELECTED_TRANSCRIPTION_ENGINE,
|
||||
"weight_type":config.WHISPER_WEIGHT_TYPE,
|
||||
}
|
||||
return {"status":200, "result":data}
|
||||
def setSelectedTranscriptionEngine(data, *args, **kwargs) -> dict:
|
||||
config.SELECTED_TRANSCRIPTION_ENGINE = str(data)
|
||||
return {"status":200, "result":config.SELECTED_TRANSCRIPTION_ENGINE}
|
||||
|
||||
@staticmethod
|
||||
def getMultiLanguageTranslation(*args, **kwargs) -> dict:
|
||||
@@ -1132,6 +1102,30 @@ class Controller:
|
||||
self.updateTranslationEngineAndEngineList()
|
||||
return {"status":200, "result":config.AUTH_KEYS["DeepL_API"]}
|
||||
|
||||
@staticmethod
|
||||
def getCtranslate2WeightType(*args, **kwargs) -> dict:
|
||||
return {"status":200, "result":config.CTRANSLATE2_WEIGHT_TYPE}
|
||||
|
||||
@staticmethod
|
||||
def setCtranslate2WeightType(data, *args, **kwargs) -> dict:
|
||||
config.CTRANSLATE2_WEIGHT_TYPE = str(data)
|
||||
if model.checkTranslatorCTranslate2ModelWeight(config.CTRANSLATE2_WEIGHT_TYPE):
|
||||
def callback():
|
||||
model.changeTranslatorCTranslate2Model()
|
||||
th_callback = Thread(target=callback)
|
||||
th_callback.daemon = True
|
||||
th_callback.start()
|
||||
return {"status":200, "result":config.CTRANSLATE2_WEIGHT_TYPE}
|
||||
|
||||
@staticmethod
|
||||
def getWhisperWeightType(*args, **kwargs) -> dict:
|
||||
return {"status":200, "result":config.WHISPER_WEIGHT_TYPE}
|
||||
|
||||
@staticmethod
|
||||
def setWhisperWeightType(data, *args, **kwargs) -> dict:
|
||||
config.WHISPER_WEIGHT_TYPE = str(data)
|
||||
return {"status":200, "result": config.WHISPER_WEIGHT_TYPE}
|
||||
|
||||
@staticmethod
|
||||
def getAutoClearMessageBox(*args, **kwargs) -> dict:
|
||||
return {"status":200, "result":config.AUTO_CLEAR_MESSAGE_BOX}
|
||||
@@ -1439,9 +1433,6 @@ class Controller:
|
||||
|
||||
def downloadWhisperWeight(self, data:str, *args, **kwargs) -> dict:
|
||||
weight_type = str(data)
|
||||
if weight_type == "none":
|
||||
pass
|
||||
else:
|
||||
download_whisper = self.DownloadWhisper(
|
||||
self.run_mapping,
|
||||
weight_type,
|
||||
@@ -1591,9 +1582,8 @@ class Controller:
|
||||
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 == "none" or weight_type_dict[weight_type] is False):
|
||||
if config.SELECTED_TRANSCRIPTION_ENGINE == "Whisper" and weight_type_dict[weight_type] is False:
|
||||
config.SELECTED_TRANSCRIPTION_ENGINE = "Google"
|
||||
config.WHISPER_WEIGHT_TYPE = "none"
|
||||
|
||||
def startCheckMicEnergy(self) -> None:
|
||||
while self.device_access_status is False:
|
||||
|
||||
@@ -137,6 +137,10 @@ mapping = {
|
||||
"/set/data/selected_translation_compute_device": {"status": True, "variable":controller.setSelectedTranslationComputeDevice},
|
||||
|
||||
"/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},
|
||||
|
||||
"/run/download_ctranslate2_weight": {"status": True, "variable":controller.downloadCtranslate2Weight},
|
||||
|
||||
"/get/data/deepl_auth_key": {"status": False, "variable":controller.getDeepLAuthKey},
|
||||
@@ -238,6 +242,8 @@ mapping = {
|
||||
"/set/data/selected_transcription_compute_device": {"status": True, "variable":controller.setSelectedTranscriptionComputeDevice},
|
||||
|
||||
"/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},
|
||||
"/run/download_whisper_weight": {"status": True, "variable":controller.downloadWhisperWeight},
|
||||
|
||||
# VR
|
||||
|
||||
Reference in New Issue
Block a user