Refactor: rename Model / ModelHolder to TTSModel / TTSModelHolder for clarification and add comments to each method
This commit is contained in:
@@ -11,7 +11,7 @@ from safetensors.torch import save_file
|
||||
|
||||
from style_bert_vits2.constants import DEFAULT_STYLE, GRADIO_THEME
|
||||
from style_bert_vits2.logging import logger
|
||||
from style_bert_vits2.tts_model import Model, ModelHolder
|
||||
from style_bert_vits2.tts_model import TTSModel, TTSModelHolder
|
||||
|
||||
|
||||
voice_keys = ["dec"]
|
||||
@@ -250,11 +250,11 @@ def simple_tts(model_name, text, style=DEFAULT_STYLE, style_weight=1.0):
|
||||
config_path = os.path.join(assets_root, model_name, "config.json")
|
||||
style_vec_path = os.path.join(assets_root, model_name, "style_vectors.npy")
|
||||
|
||||
model = Model(Path(model_path), Path(config_path), Path(style_vec_path), device)
|
||||
model = TTSModel(Path(model_path), Path(config_path), Path(style_vec_path), device)
|
||||
return model.infer(text, style=style, style_weight=style_weight)
|
||||
|
||||
|
||||
def update_two_model_names_dropdown(model_holder: ModelHolder):
|
||||
def update_two_model_names_dropdown(model_holder: TTSModelHolder):
|
||||
new_names, new_files, _ = model_holder.update_model_names_for_gradio()
|
||||
return new_names, new_files, new_names, new_files
|
||||
|
||||
@@ -328,7 +328,7 @@ Happy, Surprise, HappySurprise
|
||||
"""
|
||||
|
||||
|
||||
def create_merge_app(model_holder: ModelHolder) -> gr.Blocks:
|
||||
def create_merge_app(model_holder: TTSModelHolder) -> gr.Blocks:
|
||||
model_names = model_holder.model_names
|
||||
if len(model_names) == 0:
|
||||
logger.error(
|
||||
|
||||
Reference in New Issue
Block a user