[Update] Config Window: Translation Tab: add "Use Translation Feature" and "Select Internal Translation Model"

翻訳機能そのものを使うかどうかの設定と、内部翻訳モデルの選択UI追加

・Use Translation Feature からは True or Falseを渡し、config.USE_TRANSLATION_FEATUREへ保存します。
・Select Internal Translation Model からは 文字列 "Small" か "Large" を渡し、config.WEIGHT_TYPEへ保存します。

※機能側実装に合わせて、初回起動時config.WEIGHT_TYPEには"Small"ではなく"m2m100_418m"が入ります。
※それに合わせ、起動時はSmall固定にしています。文字列"Small"対応後、一つ下のコメントアウト部分と入れ替えてください。
This commit is contained in:
Sakamoto Shiina
2024-01-17 14:12:18 +09:00
parent 52b39e92d1
commit 369506013f
6 changed files with 129 additions and 0 deletions

View File

@@ -483,6 +483,20 @@ def callbackSetEnableRestoreMainWindowGeometry(value):
config.ENABLE_RESTORE_MAIN_WINDOW_GEOMETRY = value
# Translation Tab
def callbackSetUseTranslationFeature(value):
print("callbackSetUseTranslationFeature", value)
config.USE_TRANSLATION_FEATURE = value
if config.USE_TRANSLATION_FEATURE is True:
view.setLatestCTranslate2WeightType()
view.openCtranslate2WeightTypeWidget()
else:
view.closeCtranslate2WeightTypeWidget()
def callbackSetCtranslate2WeightType(value):
print("callbackSetCtranslate2WeightType", value)
config.WEIGHT_TYPE = str(value)
view.updateSelectedCtranslate2WeightType(config.WEIGHT_TYPE)
def callbackSetDeeplAuthkey(value):
print("callbackSetDeeplAuthkey", str(value))
if len(value) == 39:
@@ -923,6 +937,8 @@ def createMainWindow():
"callback_set_enable_restore_main_window_geometry": callbackSetEnableRestoreMainWindowGeometry,
# Translation Tab
"callback_set_use_translation_feature": callbackSetUseTranslationFeature,
"callback_set_ctranslate2_weight_type": callbackSetCtranslate2WeightType,
"callback_set_deepl_authkey": callbackSetDeeplAuthkey,
# Transcription Tab (Mic)