Add ModelType for valid model type names

This commit is contained in:
frodo821 2023-04-10 09:05:14 +09:00
parent 138d17719c
commit adcc0a2d86
No known key found for this signature in database
GPG Key ID: 29F87B8DC3A2425D

View File

@ -1,6 +1,10 @@
import os import os
import sys import sys
import tempfile import tempfile
from typing import Literal, TypeAlias
ModelType: TypeAlias = Literal['MMVCv15', 'MMVCv13', 'so-vits-svc-40v2', 'so-vits-svc-40', 'so-vits-svc-40_c', 'DDSP-SVC', 'RVC']
ERROR_NO_ONNX_SESSION = "ERROR_NO_ONNX_SESSION" ERROR_NO_ONNX_SESSION = "ERROR_NO_ONNX_SESSION"
@ -22,14 +26,14 @@ TMP_DIR = os.path.join(tmpdir.name, "tmp_dir") if hasattr(sys, "_MEIPASS") else
os.makedirs(TMP_DIR, exist_ok=True) os.makedirs(TMP_DIR, exist_ok=True)
modelType = "MMVCv15" modelType: ModelType = "MMVCv15"
def getModelType(): def getModelType() -> ModelType:
return modelType return modelType
def setModelType(_modelType: str): def setModelType(_modelType: ModelType):
global modelType global modelType
modelType = _modelType modelType = _modelType