Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -523,68 +523,76 @@ def generate_podcast_gradio(input_text, input_file, language, speaker1, speaker2
|
|
| 523 |
return result
|
| 524 |
|
| 525 |
def main():
|
| 526 |
-
# Define language options
|
| 527 |
-
language_options = [
|
| 528 |
-
"Auto Detect",
|
| 529 |
-
"Afrikaans", "Albanian", "Amharic", "Arabic", "Armenian", "Azerbaijani",
|
| 530 |
-
"Bahasa Indonesian", "Bangla", "Basque", "Bengali", "Bosnian", "Bulgarian",
|
| 531 |
-
"Burmese", "Catalan", "Chinese Cantonese", "Chinese Mandarin",
|
| 532 |
-
"Chinese Taiwanese", "Croatian", "Czech", "Danish", "Dutch", "English",
|
| 533 |
-
"Estonian", "Filipino", "Finnish", "French", "Galician", "Georgian",
|
| 534 |
-
"German", "Greek", "Hebrew", "Hindi", "Hungarian", "Icelandic", "Irish",
|
| 535 |
-
"Italian", "Japanese", "Javanese", "Kannada", "Kazakh", "Khmer", "Korean",
|
| 536 |
-
"Lao", "Latvian", "Lithuanian", "Macedonian", "Malay", "Malayalam",
|
| 537 |
-
"Maltese", "Mongolian", "Nepali", "Norwegian Bokmål", "Pashto", "Persian",
|
| 538 |
-
"Polish", "Portuguese", "Romanian", "Russian", "Serbian", "Sinhala",
|
| 539 |
-
"Slovak", "Slovene", "Somali", "Spanish", "Sundanese", "Swahili",
|
| 540 |
-
"Swedish", "Tamil", "Telugu", "Thai", "Turkish", "Ukrainian", "Urdu",
|
| 541 |
-
"Uzbek", "Vietnamese", "Welsh", "Zulu"
|
| 542 |
-
]
|
| 543 |
-
|
| 544 |
-
# Define voice options
|
| 545 |
-
voice_options = [
|
| 546 |
-
"Andrew - English (United States)",
|
| 547 |
-
"Ava - English (United States)",
|
| 548 |
-
"Brian - English (United States)",
|
| 549 |
-
"Emma - English (United States)",
|
| 550 |
-
"Florian - German (Germany)",
|
| 551 |
-
"Seraphina - German (Germany)",
|
| 552 |
-
"Remy - French (France)",
|
| 553 |
-
"Vivienne - French (France)"
|
| 554 |
-
]
|
| 555 |
-
|
| 556 |
-
# Create Gradio interface
|
| 557 |
with gr.Blocks(title="PodcastGen 🎙️") as demo:
|
| 558 |
-
gr.Markdown(
|
| 559 |
-
|
| 560 |
-
|
|
|
|
|
|
|
|
|
|
| 561 |
with gr.Row():
|
| 562 |
-
with gr.Column(
|
| 563 |
-
input_text = gr.Textbox(label="Input Text", lines=10, placeholder="Enter
|
| 564 |
-
|
| 565 |
-
with gr.Column(scale=1):
|
| 566 |
input_file = gr.File(label="Or Upload a PDF or TXT file", file_types=[".pdf", ".txt"])
|
| 567 |
-
|
| 568 |
-
with gr.Row():
|
| 569 |
with gr.Column():
|
| 570 |
-
|
| 571 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 572 |
|
| 573 |
-
with gr.Column():
|
| 574 |
-
speaker1 = gr.Dropdown(label="Speaker 1 Voice", choices=voice_options, value="Andrew - English (United States)")
|
| 575 |
-
speaker2 = gr.Dropdown(label="Speaker 2 Voice", choices=voice_options, value="Ava - English (United States)")
|
| 576 |
-
|
| 577 |
-
generate_btn = gr.Button("Generate Podcast", variant="primary")
|
| 578 |
-
|
| 579 |
-
with gr.Row():
|
| 580 |
-
output_audio = gr.Audio(label="Generated Podcast", type="filepath", format="wav")
|
| 581 |
-
|
| 582 |
generate_btn.click(
|
| 583 |
fn=generate_podcast_gradio,
|
| 584 |
inputs=[input_text, input_file, language, speaker1, speaker2, api_key],
|
| 585 |
-
outputs=
|
| 586 |
)
|
| 587 |
-
|
| 588 |
demo.launch()
|
| 589 |
|
| 590 |
if __name__ == "__main__":
|
|
|
|
| 523 |
return result
|
| 524 |
|
| 525 |
def main():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 526 |
with gr.Blocks(title="PodcastGen 🎙️") as demo:
|
| 527 |
+
gr.Markdown(
|
| 528 |
+
"""
|
| 529 |
+
# PodcastGen 🎙️
|
| 530 |
+
Generate a 2-speaker podcast from text or PDF!
|
| 531 |
+
"""
|
| 532 |
+
)
|
| 533 |
with gr.Row():
|
| 534 |
+
with gr.Column():
|
| 535 |
+
input_text = gr.Textbox(label="Input Text", lines=10, placeholder="Enter podcast topic or paste text here...", elem_id="input_text")
|
|
|
|
|
|
|
| 536 |
input_file = gr.File(label="Or Upload a PDF or TXT file", file_types=[".pdf", ".txt"])
|
|
|
|
|
|
|
| 537 |
with gr.Column():
|
| 538 |
+
language = gr.Dropdown(
|
| 539 |
+
label="Podcast Language",
|
| 540 |
+
choices=[
|
| 541 |
+
"Auto Detect",
|
| 542 |
+
"English",
|
| 543 |
+
"German",
|
| 544 |
+
"French",
|
| 545 |
+
"Spanish",
|
| 546 |
+
"Italian",
|
| 547 |
+
"Dutch",
|
| 548 |
+
"Portuguese",
|
| 549 |
+
"Russian",
|
| 550 |
+
"Chinese",
|
| 551 |
+
"Japanese",
|
| 552 |
+
"Korean",
|
| 553 |
+
"Other",
|
| 554 |
+
],
|
| 555 |
+
value="Auto Detect"
|
| 556 |
+
)
|
| 557 |
+
speaker1 = gr.Dropdown(
|
| 558 |
+
label="Speaker 1 Voice",
|
| 559 |
+
choices=[
|
| 560 |
+
"Andrew - English (United States)",
|
| 561 |
+
"Ava - English (United States)",
|
| 562 |
+
"Brian - English (United States)",
|
| 563 |
+
"Emma - English (United States)",
|
| 564 |
+
"Florian - German (Germany)",
|
| 565 |
+
"Seraphina - German (Germany)",
|
| 566 |
+
"Remy - French (France)",
|
| 567 |
+
"Vivienne - French (France)"
|
| 568 |
+
],
|
| 569 |
+
value="Andrew - English (United States)",
|
| 570 |
+
)
|
| 571 |
+
speaker2 = gr.Dropdown(
|
| 572 |
+
label="Speaker 2 Voice",
|
| 573 |
+
choices=[
|
| 574 |
+
"Andrew - English (United States)",
|
| 575 |
+
"Ava - English (United States)",
|
| 576 |
+
"Brian - English (United States)",
|
| 577 |
+
"Emma - English (United States)",
|
| 578 |
+
"Florian - German (Germany)",
|
| 579 |
+
"Seraphina - German (Germany)",
|
| 580 |
+
"Remy - French (France)",
|
| 581 |
+
"Vivienne - French (France)"
|
| 582 |
+
],
|
| 583 |
+
value="Ava - English (United States)",
|
| 584 |
+
)
|
| 585 |
+
api_key = gr.Textbox(label="Gemini API Key (Optional)", type="password", placeholder="Needed only if you're getting rate limited.")
|
| 586 |
+
|
| 587 |
+
generate_btn = gr.Button("Generate Podcast 🎙️", variant="primary")
|
| 588 |
+
output_audio = gr.Audio(label="Generated Podcast", type="filepath", format="wav", elem_id="output_audio")
|
| 589 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 590 |
generate_btn.click(
|
| 591 |
fn=generate_podcast_gradio,
|
| 592 |
inputs=[input_text, input_file, language, speaker1, speaker2, api_key],
|
| 593 |
+
outputs=output_audio
|
| 594 |
)
|
| 595 |
+
|
| 596 |
demo.launch()
|
| 597 |
|
| 598 |
if __name__ == "__main__":
|