Skip to content

Commit

Permalink
修复gpt-sovits 0322的自动识别语言bug;杂项更新
Browse files Browse the repository at this point in the history
  • Loading branch information
Ikaros-521 committed May 11, 2024
1 parent dae6199 commit 7ef1fd8
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
2 changes: 2 additions & 0 deletions 1.双击我启动程序.bat
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ SET CONDA_PATH=.\Miniconda3
REM 激活base环境
CALL %CONDA_PATH%\Scripts\activate.bat %CONDA_PATH%

SET KMP_DUPLICATE_LIB_OK=TRUE

python webui.py

cmd /k
2 changes: 1 addition & 1 deletion static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</head>
<body>

<iframe src="https://ie.cx/luna-ai-docs"></iframe>
<iframe src="https://ikaros-521.github.io/Luna-Docs/site/"></iframe>

</body>
</html>
16 changes: 15 additions & 1 deletion utils/audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,21 @@ async def tts_handle(self, message):
language = "中文" # 无法识别出语言代码时的默认值
else:
language = message["data"]["language"]


if message["data"]["api_0322"]["text_lang"] == "自动识别":
# 自动检测语言
language = self.common.lang_check(message["content"])

logging.debug(f'language={language}')

# 自定义语言名称(需要匹配请求解析)
language_name_dict = {"en": "英文", "zh": "中文", "ja": "日文"}

if language in language_name_dict:
message["data"]["api_0322"]["text_lang"] = language_name_dict[language]
else:
message["data"]["api_0322"]["text_lang"] = "中文" # 无法识别出语言代码时的默认值

data = {
"type": message["data"]["type"],
"gradio_ip_port": message["data"]["gradio_ip_port"],
Expand Down
2 changes: 1 addition & 1 deletion utils/audio_handle/my_tts.py
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,7 @@ async def websocket_client(data_json):

async def websocket_client_logic(websocket, data_json):
async for message in websocket:
logging.debug(f"Received message: {message}")
logging.debug(f"ws收到数据: {message}")

# 解析收到的消息
data = json.loads(message)
Expand Down

0 comments on commit 7ef1fd8

Please sign in to comment.