Add: test code for style-bert-vits2 as a library

By executing "hatch run test:test", you can check whether the test passes in all Python 3.9 to 3.12 environments.
This commit is contained in:
tsukumi
2024-03-10 04:18:39 +00:00
parent d2fd378b56
commit afff154da4
4 changed files with 56 additions and 6 deletions

View File

@@ -1,6 +1,6 @@
import warnings
from pathlib import Path
from typing import Any, Optional, Union
from typing import Any, Optional, Union, TypedDict
import gradio as gr
import numpy as np
@@ -263,6 +263,13 @@ class TTSModel:
return (self.hyper_parameters.data.sampling_rate, audio)
class TTSModelInfo(TypedDict):
name: str
files: list[str]
styles: list[str]
speakers: list[str]
class TTSModelHolder:
"""
Style-Bert-Vits2 の音声合成モデルを管理するクラス。
@@ -297,8 +304,7 @@ class TTSModelHolder:
self.model_files_dict: dict[str, list[Path]] = {}
self.current_model: Optional[TTSModel] = None
self.model_names: list[str] = []
self.models: list[TTSModel] = []
self.models_info: list[dict[str, Union[str, list[str]]]] = []
self.models_info: list[TTSModelInfo] = []
self.refresh()