Merge branch 'weightFile' into develop
This commit is contained in:
4
main.py
4
main.py
@@ -8,6 +8,10 @@ if __name__ == "__main__":
|
|||||||
splash.showSplash()
|
splash.showSplash()
|
||||||
|
|
||||||
from config import config
|
from config import config
|
||||||
|
# version 2.2.0からweightフォルダをweightsに変更する
|
||||||
|
from utils import renameWeightFolder
|
||||||
|
renameWeightFolder(config.PATH_LOCAL)
|
||||||
|
|
||||||
from models.translation.translation_utils import downloadCTranslate2Weight
|
from models.translation.translation_utils import downloadCTranslate2Weight
|
||||||
if config.USE_TRANSLATION_FEATURE is True:
|
if config.USE_TRANSLATION_FEATURE is True:
|
||||||
downloadCTranslate2Weight(config.PATH_LOCAL, config.CTRANSLATE2_WEIGHT_TYPE, splash.updateDownloadProgress)
|
downloadCTranslate2Weight(config.PATH_LOCAL, config.CTRANSLATE2_WEIGHT_TYPE, splash.updateDownloadProgress)
|
||||||
|
|||||||
8
utils.py
8
utils.py
@@ -1,5 +1,5 @@
|
|||||||
from typing import Union
|
from typing import Union
|
||||||
from os import path as os_path
|
from os import path as os_path, rename as os_rename
|
||||||
from PIL.Image import open as Image_open
|
from PIL.Image import open as Image_open
|
||||||
|
|
||||||
def getImageFile(file_name):
|
def getImageFile(file_name):
|
||||||
@@ -50,3 +50,9 @@ def isUniqueStrings(unique_strings:Union[str, list], input_string:str, require=F
|
|||||||
else:
|
else:
|
||||||
# If require is False, check if unique strings are used exactly once
|
# If require is False, check if unique strings are used exactly once
|
||||||
return all(count == 1 for count in counts)
|
return all(count == 1 for count in counts)
|
||||||
|
|
||||||
|
# path先のweightフォルダがある場合にはそのフォルダ名をweightsに変更する
|
||||||
|
def renameWeightFolder(path):
|
||||||
|
weight_path = os_path.join(path, "weight")
|
||||||
|
if os_path.exists(weight_path):
|
||||||
|
os_rename(weight_path, os_path.join(path, "weights"))
|
||||||
Reference in New Issue
Block a user