voice-changer/server/voice_changer/MMVCv13/MMVCv13ModelSlotGenerator.py
2023-06-21 16:00:03 +09:00

20 lines
753 B
Python

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