File size: 1,508 Bytes
416840c
f0db570
 
ecb2850
 
416840c
f0db570
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
416840c
 
 
 
f0db570
 
 
ecb2850
 
 
f0db570
416840c
f0db570
 
416840c
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import gradio as gr
from utils import generate_script, generate_audio
from prompts import SYSTEM_PROMPT
from pydub import AudioSegment
import os

def generate_podcast(file, tone, length):
    # Extract text from PDF
    # Generate script using generate_script function
    # Generate audio for each dialogue item
    # Combine audio segments
    # Return audio file and transcript

# Gradio interface
instructions = """
# Podcast Generator

Welcome to the Podcast Generator project! This tool allows you to create custom podcast episodes using AI-generated content.

## Features
* Generate podcast scripts on any topic
* Convert text to speech for a natural listening experience
* Choose the tone of your podcast
* Export episodes as MP3 files

## How to Use
1. Upload a PDF file (max 2048 tokens)
2. Select the desired tone (humorous, casual, formal)
3. Choose the podcast length
4. Click "Generate" to create your podcast
5. Listen to the generated audio and review the transcript
"""

iface = gr.Interface(
    fn=generate_podcast,
    inputs=[
        gr.File(label="Upload PDF file"),
        gr.Radio(["humorous", "casual", "formal"], label="Select podcast tone", value="casual"),
        gr.Radio(["Short (1-2 min)", "Medium (3-5 min)"], label="Podcast length", value="Medium (3-5 min)")
    ],
    outputs=[
        gr.Audio(label="Generated Podcast"),
        gr.Markdown(label="Transcript")
    ],
    title="Custom NotebookLM-type Podcast Generator",
    description=instructions
)

iface.launch()