Unify webui to single webui

This commit is contained in:
litagin02
2024-03-08 13:00:15 +09:00
parent 1cbe9648b0
commit 9f01e54d2d
7 changed files with 172 additions and 276 deletions

61
app.py
View File

@@ -1,30 +1,51 @@
import pyopenjtalk
import gradio as gr
from webui import (
create_dataset_app,
create_train_app,
create_merge_app,
create_style_vectors_app,
)
import argparse
from pathlib import Path
pyopenjtalk.unset_user_dict()
import gradio as gr
import torch
import yaml
setting_json = Path("webui/setting.json")
from common.constants import GRADIO_THEME, LATEST_VERSION
from common.tts_model import ModelHolder
from webui import (
create_dataset_app,
create_inference_app,
create_merge_app,
create_style_vectors_app,
create_train_app,
)
with gr.Blocks() as app:
# Get path settings
with Path("configs/paths.yml").open("r", encoding="utf-8") as f:
path_config: dict[str, str] = yaml.safe_load(f.read())
# dataset_root = path_config["dataset_root"]
assets_root = path_config["assets_root"]
parser = argparse.ArgumentParser()
parser.add_argument("--device", type=str, default="cuda")
parser.add_argument("--no_autolaunch", action="store_true")
parser.add_argument("--share", action="store_true")
args = parser.parse_args()
device = args.device
if device == "cuda" and not torch.cuda.is_available():
device = "cpu"
model_holder = ModelHolder(Path(assets_root), device)
with gr.Blocks(theme=GRADIO_THEME) as app:
gr.Markdown(f"# Style-Bert-VITS2 WebUI (version {LATEST_VERSION})")
with gr.Tabs():
with gr.Tab("Hello"):
gr.Markdown("## Hello, Gradio!")
gr.Textbox("input", label="Input Text")
with gr.Tab("Dataset"):
with gr.Tab("音声合成"):
create_inference_app(model_holder=model_holder)
with gr.Tab("データセット作成"):
create_dataset_app()
with gr.Tab("Train"):
with gr.Tab("学習"):
create_train_app()
with gr.Tab("Merge"):
create_merge_app()
with gr.Tab("Create Style Vectors"):
with gr.Tab("スタイル作成"):
create_style_vectors_app()
with gr.Tab("マージ"):
create_merge_app(model_holder=model_holder)
app.launch(inbrowser=True)
app.launch(inbrowser=not args.no_autolaunch, share=args.share)