voice-changer/server/voice_changer/MMVCv13/MMVCv13ModelSlotGenerator.py

20 lines
753 B
Python
Raw Normal View History

2023-06-21 10:00:03 +03:00
import os
from data.ModelSlot import MMVCv13ModelSlot
from voice_changer.utils.LoadModelParams import LoadModelParams
from voice_changer.utils.ModelSlotGenerator import ModelSlotGenerator
class MMVCv13ModelSlotGenerator(ModelSlotGenerator):
@classmethod
def loadModel(cls, props: LoadModelParams):
slotInfo: MMVCv13ModelSlot = MMVCv13ModelSlot()
for file in props.files:
if file.kind == "mmvcv13Model":
slotInfo.modelFile = file.name
elif file.kind == "mmvcv13Config":
slotInfo.configFile = file.name
slotInfo.isONNX = slotInfo.modelFile.endswith(".onnx")
slotInfo.name = os.path.splitext(os.path.basename(slotInfo.modelFile))[0]
return slotInfo