Update app.py
Browse files
app.py
CHANGED
@@ -65,6 +65,10 @@ async def render_podcast(api_key, script, voice1, voice2):
|
|
65 |
|
66 |
return (24000, podcast_audio) # edge-tts uses 24000 Hz sample rate
|
67 |
|
|
|
|
|
|
|
|
|
68 |
# Gradio Interface
|
69 |
with gr.Blocks() as demo:
|
70 |
gr.Markdown("# AI Podcast Generator")
|
@@ -77,9 +81,11 @@ with gr.Blocks() as demo:
|
|
77 |
|
78 |
duration = gr.Radio(["1-5 min", "5-10 min", "10-15 min"], label="Estimated podcast duration")
|
79 |
|
|
|
|
|
80 |
with gr.Row():
|
81 |
-
voice1_select = gr.Dropdown(label="Select Voice 1", choices=
|
82 |
-
voice2_select = gr.Dropdown(label="Select Voice 2", choices=
|
83 |
|
84 |
generate_btn = gr.Button("Generate Script")
|
85 |
script_output = gr.Textbox(label="Generated Script", lines=10)
|
@@ -96,4 +102,5 @@ with gr.Blocks() as demo:
|
|
96 |
generate_btn.click(generate_script_wrapper, inputs=[api_key_input, content_input, duration], outputs=script_output)
|
97 |
render_btn.click(render_podcast_wrapper, inputs=[api_key_input, script_output, voice1_select, voice2_select], outputs=audio_output)
|
98 |
|
99 |
-
|
|
|
|
65 |
|
66 |
return (24000, podcast_audio) # edge-tts uses 24000 Hz sample rate
|
67 |
|
68 |
+
async def get_voice_list():
|
69 |
+
voices = await edge_tts.list_voices()
|
70 |
+
return [voice["Name"] for voice in voices]
|
71 |
+
|
72 |
# Gradio Interface
|
73 |
with gr.Blocks() as demo:
|
74 |
gr.Markdown("# AI Podcast Generator")
|
|
|
81 |
|
82 |
duration = gr.Radio(["1-5 min", "5-10 min", "10-15 min"], label="Estimated podcast duration")
|
83 |
|
84 |
+
voice_list = asyncio.run(get_voice_list())
|
85 |
+
|
86 |
with gr.Row():
|
87 |
+
voice1_select = gr.Dropdown(label="Select Voice 1", choices=voice_list)
|
88 |
+
voice2_select = gr.Dropdown(label="Select Voice 2", choices=voice_list)
|
89 |
|
90 |
generate_btn = gr.Button("Generate Script")
|
91 |
script_output = gr.Textbox(label="Generated Script", lines=10)
|
|
|
102 |
generate_btn.click(generate_script_wrapper, inputs=[api_key_input, content_input, duration], outputs=script_output)
|
103 |
render_btn.click(render_podcast_wrapper, inputs=[api_key_input, script_output, voice1_select, voice2_select], outputs=audio_output)
|
104 |
|
105 |
+
if __name__ == "__main__":
|
106 |
+
demo.launch()
|