1. support voice preview
2, update version to 1.1.6
This commit is contained in:
@@ -56,7 +56,7 @@ listen_port = _cfg.get("listen_port", 8080)
|
|||||||
project_name = _cfg.get("project_name", "MoneyPrinterTurbo")
|
project_name = _cfg.get("project_name", "MoneyPrinterTurbo")
|
||||||
project_description = _cfg.get("project_description",
|
project_description = _cfg.get("project_description",
|
||||||
"<a href='https://github.com/harry0703/MoneyPrinterTurbo'>https://github.com/harry0703/MoneyPrinterTurbo</a>")
|
"<a href='https://github.com/harry0703/MoneyPrinterTurbo'>https://github.com/harry0703/MoneyPrinterTurbo</a>")
|
||||||
project_version = _cfg.get("project_version", "1.1.5")
|
project_version = _cfg.get("project_version", "1.1.6")
|
||||||
reload_debug = False
|
reload_debug = False
|
||||||
|
|
||||||
imagemagick_path = app.get("imagemagick_path", "")
|
imagemagick_path = app.get("imagemagick_path", "")
|
||||||
|
|||||||
@@ -1035,6 +1035,7 @@ def tts(text: str, voice_name: str, voice_file: str) -> [SubMaker, None]:
|
|||||||
|
|
||||||
|
|
||||||
def azure_tts_v1(text: str, voice_name: str, voice_file: str) -> [SubMaker, None]:
|
def azure_tts_v1(text: str, voice_name: str, voice_file: str) -> [SubMaker, None]:
|
||||||
|
voice_name = parse_voice_name(voice_name)
|
||||||
text = text.strip()
|
text = text.strip()
|
||||||
for i in range(3):
|
for i in range(3):
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -416,6 +416,10 @@ with middle_panel:
|
|||||||
index=0)
|
index=0)
|
||||||
with st.container(border=True):
|
with st.container(border=True):
|
||||||
st.write(tr("Audio Settings"))
|
st.write(tr("Audio Settings"))
|
||||||
|
|
||||||
|
# tts_providers = ['edge', 'azure']
|
||||||
|
# tts_provider = st.selectbox(tr("TTS Provider"), tts_providers)
|
||||||
|
|
||||||
voices = voice.get_all_azure_voices(
|
voices = voice.get_all_azure_voices(
|
||||||
filter_locals=support_locales)
|
filter_locals=support_locales)
|
||||||
friendly_names = {
|
friendly_names = {
|
||||||
@@ -442,6 +446,26 @@ with middle_panel:
|
|||||||
params.voice_name = voice_name
|
params.voice_name = voice_name
|
||||||
config.ui['voice_name'] = voice_name
|
config.ui['voice_name'] = voice_name
|
||||||
|
|
||||||
|
if st.button(tr("Play Voice")):
|
||||||
|
play_content = params.video_subject
|
||||||
|
if not play_content:
|
||||||
|
play_content = params.video_script
|
||||||
|
if not play_content:
|
||||||
|
play_content = tr("Voice Example")
|
||||||
|
with st.spinner(tr("Synthesizing Voice")):
|
||||||
|
temp_dir = utils.storage_dir("temp", create=True)
|
||||||
|
audio_file = os.path.join(temp_dir, f"tmp-voice-{str(uuid4())}.mp3")
|
||||||
|
sub_maker = voice.tts(text=play_content, voice_name=voice_name, voice_file=audio_file)
|
||||||
|
# if the voice file generation failed, try again with a default content.
|
||||||
|
if not sub_maker:
|
||||||
|
play_content = "This is a example voice. if you hear this, the voice synthesis failed with the original content."
|
||||||
|
sub_maker = voice.tts(text=play_content, voice_name=voice_name, voice_file=audio_file)
|
||||||
|
|
||||||
|
if sub_maker and os.path.exists(audio_file):
|
||||||
|
st.audio(audio_file, format="audio/mp3")
|
||||||
|
if os.path.exists(audio_file):
|
||||||
|
os.remove(audio_file)
|
||||||
|
|
||||||
if voice.is_azure_v2_voice(voice_name):
|
if voice.is_azure_v2_voice(voice_name):
|
||||||
saved_azure_speech_region = config.azure.get(f"speech_region", "")
|
saved_azure_speech_region = config.azure.get(f"speech_region", "")
|
||||||
saved_azure_speech_key = config.azure.get(f"speech_key", "")
|
saved_azure_speech_key = config.azure.get(f"speech_key", "")
|
||||||
|
|||||||
@@ -66,6 +66,10 @@
|
|||||||
"TikTok": "TikTok (TikTok support is coming soon)",
|
"TikTok": "TikTok (TikTok support is coming soon)",
|
||||||
"Bilibili": "Bilibili (Bilibili support is coming soon)",
|
"Bilibili": "Bilibili (Bilibili support is coming soon)",
|
||||||
"Xiaohongshu": "Xiaohongshu (Xiaohongshu support is coming soon)",
|
"Xiaohongshu": "Xiaohongshu (Xiaohongshu support is coming soon)",
|
||||||
"Local file": "Local file"
|
"Local file": "Local file",
|
||||||
|
"Play Voice": "Play Voice",
|
||||||
|
"Voice Example": "This is an example text for testing speech synthesis",
|
||||||
|
"Synthesizing Voice": "Synthesizing voice, please wait...",
|
||||||
|
"TTS Provider": "Select the voice synthesis provider"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -67,6 +67,10 @@
|
|||||||
"TikTok": "TikTok (TikTok support is coming soon)",
|
"TikTok": "TikTok (TikTok support is coming soon)",
|
||||||
"Bilibili": "Bilibili (Bilibili support is coming soon)",
|
"Bilibili": "Bilibili (Bilibili support is coming soon)",
|
||||||
"Xiaohongshu": "Xiaohongshu (Xiaohongshu support is coming soon)",
|
"Xiaohongshu": "Xiaohongshu (Xiaohongshu support is coming soon)",
|
||||||
"Local file": "Local file"
|
"Local file": "Local file",
|
||||||
|
"Play Voice": "Play Voice",
|
||||||
|
"Voice Example": "This is an example text for testing speech synthesis",
|
||||||
|
"Synthesizing Voice": "Synthesizing voice, please wait...",
|
||||||
|
"TTS Provider": "Select the voice synthesis provider"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -67,6 +67,10 @@
|
|||||||
"TikTok": "TikTok (TikTok support is coming soon)",
|
"TikTok": "TikTok (TikTok support is coming soon)",
|
||||||
"Bilibili": "Bilibili (Bilibili support is coming soon)",
|
"Bilibili": "Bilibili (Bilibili support is coming soon)",
|
||||||
"Xiaohongshu": "Xiaohongshu (Xiaohongshu support is coming soon)",
|
"Xiaohongshu": "Xiaohongshu (Xiaohongshu support is coming soon)",
|
||||||
"Local file": "Local file"
|
"Local file": "Local file",
|
||||||
|
"Play Voice": "Play Voice",
|
||||||
|
"Voice Example": "This is an example text for testing speech synthesis",
|
||||||
|
"Synthesizing Voice": "Synthesizing voice, please wait...",
|
||||||
|
"TTS Provider": "Select the voice synthesis provider"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,6 +67,10 @@
|
|||||||
"TikTok": "抖音 (TikTok 支持中,敬请期待)",
|
"TikTok": "抖音 (TikTok 支持中,敬请期待)",
|
||||||
"Bilibili": "哔哩哔哩 (Bilibili 支持中,敬请期待)",
|
"Bilibili": "哔哩哔哩 (Bilibili 支持中,敬请期待)",
|
||||||
"Xiaohongshu": "小红书 (Xiaohongshu 支持中,敬请期待)",
|
"Xiaohongshu": "小红书 (Xiaohongshu 支持中,敬请期待)",
|
||||||
"Local file": "本地文件"
|
"Local file": "本地文件",
|
||||||
|
"Play Voice": "试听语音合成",
|
||||||
|
"Voice Example": "这是一段测试语音合成的示例文本",
|
||||||
|
"Synthesizing Voice": "语音合成中,请稍候...",
|
||||||
|
"TTS Provider": "语音合成提供商"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user