support azure new speech voice
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import sys
|
||||
import os
|
||||
import time
|
||||
|
||||
# Add the root directory of the project to the system path to allow importing modules from the project
|
||||
root_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
|
||||
@@ -165,7 +166,6 @@ with st.expander(tr("Basic Settings"), expanded=False):
|
||||
code = selected_language.split(" - ")[0].strip()
|
||||
st.session_state['ui_language'] = code
|
||||
config.ui['language'] = code
|
||||
config.save_config()
|
||||
|
||||
with middle_config_panel:
|
||||
# openai
|
||||
@@ -207,8 +207,6 @@ with st.expander(tr("Basic Settings"), expanded=False):
|
||||
if st_llm_account_id:
|
||||
config.app[f"{llm_provider}_account_id"] = st_llm_account_id
|
||||
|
||||
config.save_config()
|
||||
|
||||
with right_config_panel:
|
||||
pexels_api_keys = config.app.get("pexels_api_keys", [])
|
||||
if isinstance(pexels_api_keys, str):
|
||||
@@ -219,7 +217,6 @@ with st.expander(tr("Basic Settings"), expanded=False):
|
||||
pexels_api_key = pexels_api_key.replace(" ", "")
|
||||
if pexels_api_key:
|
||||
config.app["pexels_api_keys"] = pexels_api_key.split(",")
|
||||
config.save_config()
|
||||
|
||||
panel = st.columns(3)
|
||||
left_panel = panel[0]
|
||||
@@ -302,20 +299,20 @@ with middle_panel:
|
||||
index=0)
|
||||
with st.container(border=True):
|
||||
st.write(tr("Audio Settings"))
|
||||
voices = voice.get_all_voices(filter_locals=["zh-CN", "zh-HK", "zh-TW", "de-DE", "en-US"])
|
||||
voices = voice.get_all_azure_voices(filter_locals=["zh-CN", "zh-HK", "zh-TW", "de-DE", "en-US", "fr-FR"])
|
||||
friendly_names = {
|
||||
voice: voice.
|
||||
v: v.
|
||||
replace("Female", tr("Female")).
|
||||
replace("Male", tr("Male")).
|
||||
replace("Neural", "") for
|
||||
voice in voices}
|
||||
v in voices}
|
||||
saved_voice_name = config.ui.get("voice_name", "")
|
||||
saved_voice_name_index = 0
|
||||
if saved_voice_name in friendly_names:
|
||||
saved_voice_name_index = list(friendly_names.keys()).index(saved_voice_name)
|
||||
else:
|
||||
for i, voice in enumerate(voices):
|
||||
if voice.lower().startswith(st.session_state['ui_language'].lower()):
|
||||
for i, v in enumerate(voices):
|
||||
if v.lower().startswith(st.session_state['ui_language'].lower()):
|
||||
saved_voice_name_index = i
|
||||
break
|
||||
|
||||
@@ -326,7 +323,13 @@ with middle_panel:
|
||||
voice_name = list(friendly_names.keys())[list(friendly_names.values()).index(selected_friendly_name)]
|
||||
params.voice_name = voice_name
|
||||
config.ui['voice_name'] = voice_name
|
||||
config.save_config()
|
||||
if voice.is_azure_v2_voice(voice_name):
|
||||
saved_azure_speech_region = config.azure.get(f"speech_region", "")
|
||||
saved_azure_speech_key = config.azure.get(f"speech_key", "")
|
||||
azure_speech_region = st.text_input(tr("Speech Region"), value=saved_azure_speech_region)
|
||||
azure_speech_key = st.text_input(tr("Speech Key"), value=saved_azure_speech_key, type="password")
|
||||
config.azure["speech_region"] = azure_speech_region
|
||||
config.azure["speech_key"] = azure_speech_key
|
||||
|
||||
params.voice_volume = st.selectbox(tr("Speech Volume"),
|
||||
options=[0.6, 0.8, 1.0, 1.2, 1.5, 2.0, 3.0, 4.0, 5.0], index=2)
|
||||
@@ -363,7 +366,6 @@ with right_panel:
|
||||
saved_font_name_index = font_names.index(saved_font_name)
|
||||
params.font_name = st.selectbox(tr("Font"), font_names, index=saved_font_name_index)
|
||||
config.ui['font_name'] = params.font_name
|
||||
config.save_config()
|
||||
|
||||
subtitle_positions = [
|
||||
(tr("Top"), "top"),
|
||||
@@ -446,3 +448,5 @@ if start_button:
|
||||
open_task_folder(task_id)
|
||||
logger.info(tr("Video Generation Completed"))
|
||||
scroll_to_bottom()
|
||||
|
||||
config.save_config()
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
"Number of Videos Generated Simultaneously": "Anzahl der parallel generierten Videos",
|
||||
"Audio Settings": "**Audio Einstellungen**",
|
||||
"Speech Synthesis": "Sprachausgabe",
|
||||
"Speech Region": "Region(:red[Required,[Get Region](https://portal.azure.com/#view/Microsoft_Azure_ProjectOxford/CognitiveServicesHub/~/SpeechServices)])",
|
||||
"Speech Key": "API Key(:red[Required,[Get API Key](https://portal.azure.com/#view/Microsoft_Azure_ProjectOxford/CognitiveServicesHub/~/SpeechServices)])",
|
||||
"Speech Volume": "Lautstärke der Sprachausgabe",
|
||||
"Male": "Männlich",
|
||||
"Female": "Weiblich",
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
"Number of Videos Generated Simultaneously": "Number of Videos Generated Simultaneously",
|
||||
"Audio Settings": "**Audio Settings**",
|
||||
"Speech Synthesis": "Speech Synthesis Voice",
|
||||
"Speech Region": "Region(:red[Required,[Get Region](https://portal.azure.com/#view/Microsoft_Azure_ProjectOxford/CognitiveServicesHub/~/SpeechServices)])",
|
||||
"Speech Key": "API Key(:red[Required,[Get API Key](https://portal.azure.com/#view/Microsoft_Azure_ProjectOxford/CognitiveServicesHub/~/SpeechServices)])",
|
||||
"Speech Volume": "Speech Volume (1.0 represents 100%)",
|
||||
"Male": "Male",
|
||||
"Female": "Female",
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
"Number of Videos Generated Simultaneously": "同时生成视频数量",
|
||||
"Audio Settings": "**音频设置**",
|
||||
"Speech Synthesis": "朗读声音(:red[尽量与文案语言保持一致])",
|
||||
"Speech Region": "服务区域(:red[必填,[点击获取](https://portal.azure.com/#view/Microsoft_Azure_ProjectOxford/CognitiveServicesHub/~/SpeechServices)])",
|
||||
"Speech Key": "API Key(:red[必填,[点击获取](https://portal.azure.com/#view/Microsoft_Azure_ProjectOxford/CognitiveServicesHub/~/SpeechServices)])",
|
||||
"Speech Volume": "朗读音量(1.0表示100%)",
|
||||
"Male": "男性",
|
||||
"Female": "女性",
|
||||
|
||||
Reference in New Issue
Block a user