Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ cache
ffmpeg.exe
ffprobe.exe
tmp_audio
trained*
history
app.log
3 changes: 3 additions & 0 deletions Synthesizers/gsv_fast/GSV_Synthesizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ def wave_header_chunk(frame_input=b"", channels=1, sample_width=2, sample_rate=3

def get_characters(self) -> dict:
characters_and_emotions = {}
# self.models_path = os.environ.get('models_path', 'trained')
self.models_path = self.ui_config.get('models_path', 'trained')
print(f"get_characters trained模型地址: {os.environ.get('models_path', 'trained')}")

# 遍历模型路径下的所有文件夹
for character_subdir in os.listdir(self.models_path):
Expand Down
827 changes: 628 additions & 199 deletions app.py

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions common_config.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"app_config": {
"locale": {
"default": "auto",
"default": "zh_CN",
"description": "Locale settings for the application",
"label": "语言",
"type": "string"
"type": "string",
"choices": ["en_US", "zh_CN", "zh_TW"]
},
"server_port": {
"default": 5000,
Expand Down
11 changes: 11 additions & 0 deletions start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
pkill -f "app.py"
# ps -ef | grep "app.py" | awk '{print $2}' | xargs kill -9

source ~/anaconda3/etc/profile.d/conda.sh
conda activate torch

nohup python app.py 2>&1 > app.log &


# conda activate torch
# python webuis/character_manager/webui.py
29 changes: 17 additions & 12 deletions tools/i18n/i18n.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,31 @@
import os
import json
import locale
import os


def load_language_list(language, locale_path="./i18n/locale"):
with open(os.path.join(locale_path, f"{language}.json"), "r", encoding="utf-8") as f:
language_list = json.load(f)
return language_list

from src.common_config_manager import app_config

def load_language_list(language, locale_paths):
language_map = {}
for locale_path in locale_paths:
lang_file = os.path.join(locale_path, f"{language}.json")
if os.path.exists(lang_file):
with open(lang_file, 'r', encoding='utf-8') as f:
language_map.update(json.load(f))
return language_map

class I18nAuto:
def __init__(self, language=None, locale_path="./i18n/locale"):
def __init__(self, language=None, locale_paths=[], locale_path="./i18n/locale"):
if language in ["auto", None]:
if app_config.locale in ["auto", None, ""]:
language = locale.getdefaultlocale()[0]
else:
language = app_config.locale
if not os.path.exists(os.path.join(locale_path, f"{language}.json")):
language = "en_US"
if not any(os.path.exists(os.path.join(locale_path, f"{language}.json")) for locale_path in locale_paths):
language = "zh_CN"
self.language = language
self.language_map = load_language_list(language, locale_path)
if len(locale_paths):
self.language_map = load_language_list(language, locale_paths)
else:
self.language_map = load_language_list(language, [locale_path])

def __call__(self, key):
return self.language_map.get(key, key)
Expand Down
3 changes: 0 additions & 3 deletions trained/.gitignore

This file was deleted.

10 changes: 5 additions & 5 deletions webuis/builders/gradio_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@ class GradioTabBuilder:
gradio_input_dict (Dict[str, Any]): A dictionary of Gradio inputs.

Methods:
__init__(self, component_name_list: List[str|List[str]], params_config: Dict[str, ParamItem]): Initializes the GradioTabBuilder object.
__init__(self, component_name_list: List[Union[str, List[str]]], params_config: Dict[str, ParamItem]): Initializes the GradioTabBuilder object.
add_input(self, name: str, input: Any): Adds an input to the gradio_input_dict.
build_group(self, component_list: List[ParamItem]): Builds a group of components.
build(self): Builds the Gradio tab and returns the gradio_input_dict.
"""

component_group_list: List[List[ParamItem]]
gradio_input_dict: Dict[str, Any]
def __init__(self, component_name_list: List[str|List[str]], params_config: Dict[str, ParamItem]):
def __init__(self, component_name_list: List[Union[str, List[str]]], params_config: Dict[str, ParamItem]):
"""
Initializes the GradioTabBuilder object.

Args:
component_name_list (List[str|List[str]]): A list of component names or groups of component names.
component_name_list (List[Union[str, List[str]]]): A list of component names or groups of component names.
params_config (Dict[str, ParamItem]): A dictionary of parameter configurations.
"""
self.component_group_list = []
Expand Down Expand Up @@ -106,12 +106,12 @@ def emit_on_change(*data):
"""
pass

def register_on_change(component_name_list: List[str|List[str]], all_gradio_components: Dict[str, Any]):
def register_on_change(component_name_list: List[Union[str, List[str]]], all_gradio_components: Dict[str, Any]):
"""
Registers an on_change function for the Gradio inputs.

Args:
component_name_list (List[str|List[str]]): A list of component names or groups of component names.
component_name_list (List[Union[str, List[str]]]): A list of component names or groups of component names.
gradio_input_dict (Dict[str, Any]): The Gradio input dictionary.
on_change (Optional[Callable[[Dict[str, Any]], None]]): The on_change function to register.
"""
Expand Down
Loading