101 lines
2.3 KiB
Python
Raw Normal View History

2023-05-02 12:11:00 +09:00
from enum import Enum
2023-01-28 14:01:23 +09:00
import os
import sys
2023-01-16 05:22:27 +09:00
import tempfile
from typing import Literal, TypeAlias
2023-04-28 06:39:51 +09:00
ModelType: TypeAlias = Literal[
"MMVCv15",
"MMVCv13",
"so-vits-svc-40v2",
"so-vits-svc-40",
"so-vits-svc-40_c",
"DDSP-SVC",
"RVC",
]
2023-01-08 17:58:27 +09:00
ERROR_NO_ONNX_SESSION = "ERROR_NO_ONNX_SESSION"
2023-01-16 05:31:49 +09:00
tmpdir = tempfile.TemporaryDirectory()
2023-01-16 07:26:24 +09:00
# print("generate tmpdir:::",tmpdir)
2023-01-28 14:01:23 +09:00
SSL_KEY_DIR = os.path.join(tmpdir.name, "keys") if hasattr(sys, "_MEIPASS") else "keys"
2023-01-16 05:31:49 +09:00
MODEL_DIR = os.path.join(tmpdir.name, "logs") if hasattr(sys, "_MEIPASS") else "logs"
2023-04-28 06:39:51 +09:00
UPLOAD_DIR = (
os.path.join(tmpdir.name, "upload_dir")
if hasattr(sys, "_MEIPASS")
else "upload_dir"
)
NATIVE_CLIENT_FILE_WIN = (
os.path.join(sys._MEIPASS, "voice-changer-native-client.exe") # type: ignore
if hasattr(sys, "_MEIPASS")
else "voice-changer-native-client"
)
NATIVE_CLIENT_FILE_MAC = (
os.path.join(
sys._MEIPASS, # type: ignore
"voice-changer-native-client.app",
"Contents",
"MacOS",
"voice-changer-native-client",
)
if hasattr(sys, "_MEIPASS")
else "voice-changer-native-client"
)
2023-01-28 14:01:23 +09:00
2023-04-28 06:39:51 +09:00
HUBERT_ONNX_MODEL_PATH = (
os.path.join(sys._MEIPASS, "model_hubert/hubert_simple.onnx") # type: ignore
if hasattr(sys, "_MEIPASS")
else "model_hubert/hubert_simple.onnx"
)
2023-03-31 00:53:00 +09:00
2023-01-28 14:01:23 +09:00
2023-04-28 06:39:51 +09:00
TMP_DIR = (
os.path.join(tmpdir.name, "tmp_dir") if hasattr(sys, "_MEIPASS") else "tmp_dir"
)
2023-02-15 05:02:51 +09:00
os.makedirs(TMP_DIR, exist_ok=True)
2023-03-08 09:48:50 +09:00
def getFrontendPath():
2023-04-28 06:39:51 +09:00
frontend_path = (
os.path.join(sys._MEIPASS, "dist")
if hasattr(sys, "_MEIPASS")
else "../client/demo/dist"
)
2023-03-08 09:48:50 +09:00
return frontend_path
2023-05-02 12:11:00 +09:00
2023-05-02 20:57:12 +09:00
# "hubert_base", "contentvec", "distilhubert"
2023-05-02 12:11:00 +09:00
class EnumEmbedderTypes(Enum):
2023-05-02 20:57:12 +09:00
hubert = "hubert_base"
2023-05-02 12:11:00 +09:00
contentvec = "contentvec"
2023-05-02 20:57:12 +09:00
hubert_jp = "hubert-base-japanese"
class EnumInferenceTypes(Enum):
pyTorchRVC = "pyTorchRVC"
pyTorchRVCNono = "pyTorchRVCNono"
pyTorchWebUI = "pyTorchWebUI"
pyTorchWebUINono = "pyTorchWebUINono"
onnxRVC = "onnxRVC"
onnxRVCNono = "onnxRVCNono"
2023-05-02 22:29:28 +09:00
class EnumPitchExtractorTypes(Enum):
harvest = "harvest"
dio = "dio"
2023-05-02 20:57:12 +09:00
class EnumFrameworkTypes(Enum):
pyTorch = "pyTorch"
onnx = "onnx"
2023-05-07 04:18:18 +09:00
class ServerAudioDeviceTypes(Enum):
audioinput = "audioinput"
audiooutput = "audiooutput"
2023-05-16 10:38:23 +09:00
SAMPLES_JSON = "https://huggingface.co/wok000/vcclient_model/raw/main/samples.json"