2023-01-28 08:01:23 +03:00
|
|
|
import os
|
|
|
|
import sys
|
2023-01-15 23:22:27 +03:00
|
|
|
import tempfile
|
2023-01-08 11:58:27 +03:00
|
|
|
|
|
|
|
ERROR_NO_ONNX_SESSION = "ERROR_NO_ONNX_SESSION"
|
|
|
|
|
2023-01-15 23:31:49 +03:00
|
|
|
|
|
|
|
tmpdir = tempfile.TemporaryDirectory()
|
2023-01-16 01:26:24 +03:00
|
|
|
# print("generate tmpdir:::",tmpdir)
|
2023-01-28 08:01:23 +03:00
|
|
|
SSL_KEY_DIR = os.path.join(tmpdir.name, "keys") if hasattr(sys, "_MEIPASS") else "keys"
|
2023-01-15 23:31:49 +03:00
|
|
|
MODEL_DIR = os.path.join(tmpdir.name, "logs") if hasattr(sys, "_MEIPASS") else "logs"
|
|
|
|
UPLOAD_DIR = os.path.join(tmpdir.name, "upload_dir") if hasattr(sys, "_MEIPASS") else "upload_dir"
|
2023-01-28 08:09:00 +03:00
|
|
|
NATIVE_CLIENT_FILE_WIN = os.path.join(sys._MEIPASS, "voice-changer-native-client.exe") if hasattr(sys, "_MEIPASS") else "voice-changer-native-client"
|
|
|
|
NATIVE_CLIENT_FILE_MAC = os.path.join(sys._MEIPASS, "voice-changer-native-client.app", "Contents", "MacOS",
|
|
|
|
"voice-changer-native-client") if hasattr(sys, "_MEIPASS") else "voice-changer-native-client"
|
2023-01-28 08:01:23 +03:00
|
|
|
|
|
|
|
|
2023-02-14 23:02:51 +03:00
|
|
|
TMP_DIR = os.path.join(tmpdir.name, "tmp_dir") if hasattr(sys, "_MEIPASS") else "tmp_dir"
|
|
|
|
os.makedirs(TMP_DIR, exist_ok=True)
|
|
|
|
|
2023-03-08 03:48:50 +03:00
|
|
|
|
|
|
|
modelType = "MMVCv15"
|
|
|
|
|
|
|
|
|
|
|
|
def getModelType():
|
|
|
|
return modelType
|
|
|
|
|
|
|
|
|
|
|
|
def setModelType(_modelType: str):
|
|
|
|
global modelType
|
|
|
|
modelType = _modelType
|
|
|
|
|
|
|
|
|
|
|
|
def getFrontendPath():
|
|
|
|
if modelType == "MMVCv15":
|
2023-03-08 03:54:55 +03:00
|
|
|
frontend_path = os.path.join(sys._MEIPASS, "dist_v15") if hasattr(sys, "_MEIPASS") else "../client/demo_v15/dist"
|
2023-03-08 03:48:50 +03:00
|
|
|
elif modelType == "MMVCv13":
|
2023-03-08 03:54:55 +03:00
|
|
|
frontend_path = os.path.join(sys._MEIPASS, "dist_v13") if hasattr(sys, "_MEIPASS") else "../client/demo_v13/dist"
|
2023-03-18 19:43:36 +03:00
|
|
|
elif modelType == "so-vits-svc-40":
|
|
|
|
frontend_path = os.path.join(sys._MEIPASS, "dist_so-vits-svc_40") if hasattr(sys, "_MEIPASS") else "../client/demo_so-vits-svc_40/dist"
|
2023-03-10 19:56:10 +03:00
|
|
|
elif modelType == "so-vits-svc-40v2":
|
2023-03-12 20:54:15 +03:00
|
|
|
frontend_path = os.path.join(sys._MEIPASS, "dist_so-vits-svc_40v2") if hasattr(sys, "_MEIPASS") else "../client/demo_so-vits-svc_40v2/dist"
|
2023-03-24 02:44:06 +03:00
|
|
|
elif modelType == "DDSP-SVC":
|
|
|
|
frontend_path = os.path.join(sys._MEIPASS, "dist_DDSP-SVC") if hasattr(sys, "_MEIPASS") else "../client/demo_DDSP-SVC/dist"
|
|
|
|
|
|
|
|
# elif modelType == "so-vits-svc-40v2_tsukuyomi":
|
|
|
|
# frontend_path = os.path.join(sys._MEIPASS, "dist_so-vits-svc_40v2_tsukuyomi") if hasattr(sys, "_MEIPASS") \
|
|
|
|
# else "../client/demo_so-vits-svc_40v2_tsukuyomi/dist"
|
2023-03-30 05:11:41 +03:00
|
|
|
elif modelType == "so-vits-svc-40_c":
|
|
|
|
frontend_path = os.path.join(sys._MEIPASS, "dist_so-vits-svc_40_c") if hasattr(sys, "_MEIPASS") \
|
|
|
|
else "../client/demo_so-vits-svc_40_c/dist"
|
2023-03-24 02:44:06 +03:00
|
|
|
elif modelType == "so-vits-svc-40v2_c":
|
|
|
|
frontend_path = os.path.join(sys._MEIPASS, "dist_so-vits-svc_40v2_c") if hasattr(sys, "_MEIPASS") \
|
|
|
|
else "../client/demo_so-vits-svc_40v2_c/dist"
|
2023-03-08 03:48:50 +03:00
|
|
|
return frontend_path
|