Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -87,8 +87,8 @@ def process_json_and_generate_audio(prompt_audio_role0_file, prompt_text_role0,
|
|
87 |
# return str(e) # 返回错误信息给 Gradio
|
88 |
raise gr.Error(str(e))
|
89 |
|
90 |
-
title_en = "# PODCAST generator (supports English and Chinese)"
|
91 |
-
title_zh = "# 播客生成 (支持英文和中文)"
|
92 |
|
93 |
input_labels_en = ["Prompt Audio for Role 0", "Prompt Text for Role 0", "Prompt Audio for Role 1", "Prompt Text for Role 1", "Dialogue JSON Input"]
|
94 |
input_labels_zh = ["角色 0 的 Prompt 音频", "角色 0 的 Prompt 文本", "角色 1 的 Prompt 音频", "角色 1 的 Prompt 文本", "对话 JSON 输入"]
|
@@ -162,7 +162,7 @@ def update_ui_language(language):
|
|
162 |
gr.update(label=input_labels_en[3]), \
|
163 |
gr.update(label=input_labels_en[4], placeholder=text_placeholder_en), \
|
164 |
gr.update(label=output_label_en), \
|
165 |
-
gr.update(value="
|
166 |
gr.update(label="Examples (Demonstration Use Only. Do Not Redistribute.)", headers=input_labels_en)
|
167 |
|
168 |
elif language == "中文":
|
@@ -174,14 +174,14 @@ def update_ui_language(language):
|
|
174 |
gr.update(label=input_labels_zh[3]), \
|
175 |
gr.update(label=input_labels_zh[4], placeholder=text_placeholder_zh), \
|
176 |
gr.update(label=output_label_zh), \
|
177 |
-
gr.update(value="
|
178 |
gr.update(label="示例 (仅用于展示,切勿私自传播。)", headers=input_labels_zh)
|
179 |
|
180 |
else:
|
181 |
raise ValueError("Invalid language selected")
|
182 |
|
183 |
|
184 |
-
audio_output = gr.Audio(label=
|
185 |
css = """
|
186 |
.centered-title { /* CSS rule for centering title */
|
187 |
text-align: center !important;
|
@@ -212,7 +212,7 @@ with gr.Blocks(css=css) as iface:
|
|
212 |
label="示例(仅用于展示,切勿私自传播。)",
|
213 |
)
|
214 |
|
215 |
-
submit_button = gr.Button("
|
216 |
|
217 |
submit_button.click(
|
218 |
fn=process_json_and_generate_audio,
|
|
|
87 |
# return str(e) # 返回错误信息给 Gradio
|
88 |
raise gr.Error(str(e))
|
89 |
|
90 |
+
title_en = "# MoonCast PODCAST generator (supports English and Chinese)"
|
91 |
+
title_zh = "# MoonCast 播客生成 (支持英文和中文)"
|
92 |
|
93 |
input_labels_en = ["Prompt Audio for Role 0", "Prompt Text for Role 0", "Prompt Audio for Role 1", "Prompt Text for Role 1", "Dialogue JSON Input"]
|
94 |
input_labels_zh = ["角色 0 的 Prompt 音频", "角色 0 的 Prompt 文本", "角色 1 的 Prompt 音频", "角色 1 的 Prompt 文本", "对话 JSON 输入"]
|
|
|
162 |
gr.update(label=input_labels_en[3]), \
|
163 |
gr.update(label=input_labels_en[4], placeholder=text_placeholder_en), \
|
164 |
gr.update(label=output_label_en), \
|
165 |
+
gr.update(value="Generate Audios"), \
|
166 |
gr.update(label="Examples (Demonstration Use Only. Do Not Redistribute.)", headers=input_labels_en)
|
167 |
|
168 |
elif language == "中文":
|
|
|
174 |
gr.update(label=input_labels_zh[3]), \
|
175 |
gr.update(label=input_labels_zh[4], placeholder=text_placeholder_zh), \
|
176 |
gr.update(label=output_label_zh), \
|
177 |
+
gr.update(value="生成音频"), \
|
178 |
gr.update(label="示例 (仅用于展示,切勿私自传播。)", headers=input_labels_zh)
|
179 |
|
180 |
else:
|
181 |
raise ValueError("Invalid language selected")
|
182 |
|
183 |
|
184 |
+
audio_output = gr.Audio(label=output_label_zh, streaming=True)
|
185 |
css = """
|
186 |
.centered-title { /* CSS rule for centering title */
|
187 |
text-align: center !important;
|
|
|
212 |
label="示例(仅用于展示,切勿私自传播。)",
|
213 |
)
|
214 |
|
215 |
+
submit_button = gr.Button("生成音频")
|
216 |
|
217 |
submit_button.click(
|
218 |
fn=process_json_and_generate_audio,
|