Spaces:
Configuration error
Configuration error
Upload app.py
Browse files
app.py
CHANGED
|
@@ -115,9 +115,9 @@ Follow this JSON example structure, MUST be in {language} language:
|
|
| 115 |
|
| 116 |
async def tts_generate(input_text, speaker1, speaker2):
|
| 117 |
voice_names = {
|
| 118 |
-
"家豪 -
|
| 119 |
-
"淑芬 -
|
| 120 |
-
"子晴 -
|
| 121 |
"品妍 - 中文 (Female)": "zh-CN-XiaoxiaoNeural",
|
| 122 |
"美玲 - 中文 (Female)": "zh-CN-XiaoyiNeural",
|
| 123 |
"建宏 - 中文 (Male)": "zh-CN-YunjianNeural",
|
|
@@ -285,24 +285,25 @@ body {
|
|
| 285 |
"""
|
| 286 |
|
| 287 |
with gr.Blocks(theme=gr.themes.Monochrome(), css=custom_css) as iface:
|
| 288 |
-
gr.Markdown("# 🎙️
|
|
|
|
| 289 |
|
| 290 |
input_text = gr.Textbox(label="請輸入 Podcast 話題(建議50~500字之間)", placeholder="輸入 Podcast 話題內容越詳細劇本越佳 ......", elem_classes="input-background")
|
| 291 |
|
| 292 |
with gr.Row():
|
| 293 |
Language = gr.Dropdown(
|
| 294 |
-
choices=["繁體中文", "Auto Detect", "English", "日本語", "한국어"],
|
| 295 |
value="繁體中文",
|
| 296 |
-
label="語言",
|
| 297 |
interactive=True,
|
| 298 |
scale=1,
|
| 299 |
elem_classes="lng-background"
|
| 300 |
)
|
| 301 |
|
| 302 |
speaker_choices = [
|
| 303 |
-
"家豪 -
|
| 304 |
-
"淑芬 -
|
| 305 |
-
"子晴 -
|
| 306 |
"品睿 - 中文 (Male)",
|
| 307 |
"品妍 - 中文 (Female)",
|
| 308 |
"志明 - 中文 (Male)",
|
|
@@ -322,8 +323,8 @@ with gr.Blocks(theme=gr.themes.Monochrome(), css=custom_css) as iface:
|
|
| 322 |
|
| 323 |
Speaker_1 = gr.Dropdown(
|
| 324 |
choices=speaker_choices,
|
| 325 |
-
value="
|
| 326 |
-
label="
|
| 327 |
interactive=True,
|
| 328 |
scale=2,
|
| 329 |
elem_classes="sk1-background"
|
|
@@ -331,7 +332,7 @@ with gr.Blocks(theme=gr.themes.Monochrome(), css=custom_css) as iface:
|
|
| 331 |
Speaker_2 = gr.Dropdown(
|
| 332 |
choices=speaker_choices,
|
| 333 |
value="品妍 - 中文 (Female)",
|
| 334 |
-
label="
|
| 335 |
interactive=True,
|
| 336 |
scale=2,
|
| 337 |
elem_classes="sk2-background"
|
|
@@ -345,7 +346,7 @@ with gr.Blocks(theme=gr.themes.Monochrome(), css=custom_css) as iface:
|
|
| 345 |
api_key = gr.Textbox(label="請輸入您的 API Key", type="password", placeholder="API authentication key for large language models", scale=1, elem_classes="api-background")
|
| 346 |
|
| 347 |
audio_output = gr.Audio(label="Generated Podcast Audio", elem_classes="audio-background")
|
| 348 |
-
podcast_script = gr.Textbox(label="Generated Podcast
|
| 349 |
generate_button.click(fn=process_podcast, inputs=[input_text, Language, Speaker_1, Speaker_2, api_key], outputs=[podcast_script, audio_output])
|
| 350 |
|
| 351 |
if __name__ == "__main__":
|
|
|
|
| 115 |
|
| 116 |
async def tts_generate(input_text, speaker1, speaker2):
|
| 117 |
voice_names = {
|
| 118 |
+
"家豪 - 中文 (Male)": "zh-TW-YunJheNeural",
|
| 119 |
+
"淑芬 - 中文 (Female)": "zh-TW-HsiaoChenNeural",
|
| 120 |
+
"子晴 - 中文 (Female)": "zh-TW-HsiaoYuNeural",
|
| 121 |
"品妍 - 中文 (Female)": "zh-CN-XiaoxiaoNeural",
|
| 122 |
"美玲 - 中文 (Female)": "zh-CN-XiaoyiNeural",
|
| 123 |
"建宏 - 中文 (Male)": "zh-CN-YunjianNeural",
|
|
|
|
| 285 |
"""
|
| 286 |
|
| 287 |
with gr.Blocks(theme=gr.themes.Monochrome(), css=custom_css) as iface:
|
| 288 |
+
gr.Markdown("# 🎙️ 聲音行銷企劃 - 財資歐北共 Podcast 🎙️", elem_classes="center-aligned")
|
| 289 |
+
gr.Markdown("※ 自動生成 Podcast 節目及音檔,系統布署:江信宗,LLM:Llama-3.1-405B-Instruct。", elem_classes="center-aligned")
|
| 290 |
|
| 291 |
input_text = gr.Textbox(label="請輸入 Podcast 話題(建議50~500字之間)", placeholder="輸入 Podcast 話題內容越詳細劇本越佳 ......", elem_classes="input-background")
|
| 292 |
|
| 293 |
with gr.Row():
|
| 294 |
Language = gr.Dropdown(
|
| 295 |
+
choices=["繁體中文", "Auto Detect", "English", "日本語", "한국어", "Deutsch", "Français"],
|
| 296 |
value="繁體中文",
|
| 297 |
+
label="節目語言",
|
| 298 |
interactive=True,
|
| 299 |
scale=1,
|
| 300 |
elem_classes="lng-background"
|
| 301 |
)
|
| 302 |
|
| 303 |
speaker_choices = [
|
| 304 |
+
"家豪 - 中文 (Male)",
|
| 305 |
+
"淑芬 - 中文 (Female)",
|
| 306 |
+
"子晴 - 中文 (Female)",
|
| 307 |
"品睿 - 中文 (Male)",
|
| 308 |
"品妍 - 中文 (Female)",
|
| 309 |
"志明 - 中文 (Male)",
|
|
|
|
| 323 |
|
| 324 |
Speaker_1 = gr.Dropdown(
|
| 325 |
choices=speaker_choices,
|
| 326 |
+
value="品睿 - 中文 (Male)",
|
| 327 |
+
label="#1播客語音",
|
| 328 |
interactive=True,
|
| 329 |
scale=2,
|
| 330 |
elem_classes="sk1-background"
|
|
|
|
| 332 |
Speaker_2 = gr.Dropdown(
|
| 333 |
choices=speaker_choices,
|
| 334 |
value="品妍 - 中文 (Female)",
|
| 335 |
+
label="#2播客語音",
|
| 336 |
interactive=True,
|
| 337 |
scale=2,
|
| 338 |
elem_classes="sk2-background"
|
|
|
|
| 346 |
api_key = gr.Textbox(label="請輸入您的 API Key", type="password", placeholder="API authentication key for large language models", scale=1, elem_classes="api-background")
|
| 347 |
|
| 348 |
audio_output = gr.Audio(label="Generated Podcast Audio", elem_classes="audio-background")
|
| 349 |
+
podcast_script = gr.Textbox(label="Generated Podcast 文案", elem_classes="script-background")
|
| 350 |
generate_button.click(fn=process_podcast, inputs=[input_text, Language, Speaker_1, Speaker_2, api_key], outputs=[podcast_script, audio_output])
|
| 351 |
|
| 352 |
if __name__ == "__main__":
|