Refactor: TTSModelInfo changed from TypedDict to Pydantic model

Pydantic models are more robust and properties can be accessed by dots.
This commit is contained in:
tsukumi
2024-03-10 19:21:22 +00:00
parent 859d940916
commit 7f02b0f1d5
3 changed files with 14 additions and 13 deletions

View File

@@ -13,12 +13,12 @@ def synthesize(device: str = 'cpu'):
# jvnv-F2-jp モデルを探す
for model_info in model_holder.models_info:
if model_info['name'] == 'jvnv-F2-jp':
if model_info.name == 'jvnv-F2-jp':
# すべてのスタイルに対して音声合成を実行
for style in model_info['styles']:
for style in model_info.styles:
# 音声合成を実行
model = model_holder.get_model(model_info['name'], model_info['files'][0])
model = model_holder.get_model(model_info.name, model_info.files[0])
model.load()
sample_rate, audio_data = model.infer(
"あらゆる現実を、すべて自分のほうへねじ曲げたのだ。",