voice-changer/server/voice_changer/SoVitsSvc40/SoVitsSvc40ModelSlotGenerator.py
2023-06-22 07:40:06 +09:00

22 lines
878 B
Python

import os
from data.ModelSlot import SoVitsSvc40ModelSlot
from voice_changer.utils.LoadModelParams import LoadModelParams
from voice_changer.utils.ModelSlotGenerator import ModelSlotGenerator
class SoVitsSvc40ModelSlotGenerator(ModelSlotGenerator):
@classmethod
def loadModel(cls, props: LoadModelParams):
slotInfo: SoVitsSvc40ModelSlot = SoVitsSvc40ModelSlot()
for file in props.files:
if file.kind == "soVitsSvc40Config":
slotInfo.configFile = file.name
elif file.kind == "soVitsSvc40Model":
slotInfo.modelFile = file.name
elif file.kind == "soVitsSvc40Cluster":
slotInfo.clusterFile = file.name
slotInfo.isONNX = slotInfo.modelFile.endswith(".onnx")
slotInfo.name = os.path.splitext(os.path.basename(slotInfo.modelFile))[0]
return slotInfo