Quickstart with CLI
mainYou can generate a podcast directly from the command line by invoking the podcastfy.client module and providing URLs via the --url flag.
python -m podcastfy.client --url <url1> --url <url2>repository·main·Indexed 27 days ago
https://github.com/souzatharsis/podcastfyAn open-source Python package and programmatic alternative to NotebookLM that transforms multimodal content—including text, images, websites, PDFs, and YouTube videos—into multilingual audio conversations using Generative AI. It provides a Python API, a CLI, and a FastAPI implementation for generating podcasts, with support for local LLMs and various TTS models such as OpenAI, ElevenLabs, and Edge.
You can generate a podcast directly from the command line by invoking the podcastfy.client module and providing URLs via the --url flag.
python -m podcastfy.client --url <url1> --url <url2>Use the generate_podcast function from podcastfy.client to convert one or more URLs into an audio podcast file.
from podcastfy.client import generate_podcast
audio_file = generate_podcast(urls=["<url1>", "<url2>"])Dockerfile_api. For detailed request structures and endpoint usage, refer to the project's notebook examples.To ensure the installation is working correctly, verify that the podcastfy package can be imported within the container.
For Production:
docker run --rm ghcr.io/souzatharsis/podcastfy:latest python3 -c "import podcastfy"For Development:
docker-compose exec podcastfy-dev python3 -c "import podcastfy"# Check production version
docker run --rm ghcr.io/souzatharsis/podcastfy:latest python3 -c "import podcastfy"
# Check development setup
docker-compose exec podcastfy-dev python3 -c "import podcastfy"Podcastfy supports local LLMs via llamafile. To use a local model, you must download a llamafile from HuggingFace, make it executable, and run it as a server. By default, the server listens at http://localhost:8080.
# Download a llamafile from HuggingFace
wget https://huggingface.co/jartine/TinyLlama-1.1B-Chat-v1.0-GGUF/resolve/main/TinyLlama-1.1B-Chat-v1.0.Q5_K_M.llamafile
# Make the file executable. On Windows, instead just rename the file to end in ".exe".
chmod +x TinyLlama-1.1B-Chat-v1.0.Q5_K_M.llamafile
# Start the model server. Listens at http://localhost:8080 by default.
./TinyLlama-1.1B-Chat-v1.0.Q5_K_M.llamafile --server --nobrowserYou can customize the podcast's tone, length, and style using a conversation_config.yaml file or a dictionary in Python.
CLI Usage:
Pass the path to your YAML file using --conversation-config.
python -m podcastfy.client --url https://example.com/article1 --tts-model elevenlabs --conversation-config path/to/custom_config.yamlPython Usage:
Pass a dictionary to the conversation_config parameter in generate_podcast.
Supported Config Keys:
word_count: Target word count.conversation_style: List of styles (e.g., ["casual", "humorous"]).podcast_name: Name of the podcast.creativity: Float value for creativity.from podcastfy.client import generate_podcast
custom_config = {
"word_count": 200,
"conversation_style": ["casual", "humorous"],
"podcast_name": "Tech Chuckles",
"creativity": 0.7
}
generate_podcast(
urls=["https://example.com/tech-news"],
conversation_config=custom_config
)Podcastfy uses a .env file in the project root to manage sensitive information. You must create this file and add your required API keys based on your chosen LLM and TTS models.
Required Keys:
GEMINI_API_KEY: Required for transcript generation (unless using a local LLM).OPENAI_API_KEY or ELEVENLABS_API_KEY: Required for audio generation (unless using tts_model=edge).Warning: Never commit your .env file to version control.
GEMINI_API_KEY=your_gemini_api_key_here
ELEVENLABS_API_KEY=your_elevenlabs_api_key_here
OPENAI_API_KEY=your_openai_api_key_hereYou can pass a conversation_config dictionary to generate_podcast to control the persona, tone, and flow of the audio.
Supported customization keys include:
conversation_style: A list of styles (e.g., ["formal", "debate"], ["instructional", "step-by-step"], ["adventurous", "narrative"]).roles_person1: The persona for the first speaker.roles_person2: The persona for the second speaker.dialogue_structure: A list defining the sequence of the conversation (e.g., ["Introduction", "Conclusion"]).creativity: A float value (e.g., 0.4 or 1.0) to adjust the LLM's output randomness.word_count: Target length for the transcript.engagement_techniques: A list of techniques to include (e.g., ["code examples", "troubleshooting tips"]).from podcastfy import generate_podcast
# Example: Academic Debate Configuration
debate_config = {
"conversation_style": ["formal", "debate"],
"roles_person1": "main presenter",
"roles_person2": "opposing viewpoint",
"dialogue_structure": ["Introduction", "Argument Presentation", "Counterarguments", "Conclusion"]
}
generate_podcast(
urls=["PATH/TO/academic-article.pdf"],
conversation_config=debate_config
)For contributing or active development, use the pre-built development image which includes tools like flake8 and pytest and runs in editable mode.
docker pull ghcr.io/souzatharsis/podcastfy:devgit clone https://github.com/souzatharsis/podcastfy.git
cd podcastfy
docker-compose up podcastfy-devThe development container exposes port 8001.
docker pull ghcr.io/souzatharsis/podcastfy:dev
git clone https://github.com/souzatharsis/podcastfy.git
cd podcastfy
docker-compose up podcastfy-devUse the user_instructions parameter in your custom configuration to guide the AI hosts on specific topics or audience targeting.
Example YAML configuration:
user_instructions: "Make connections with quantum computing"Example CLI command:
python -m podcastfy.client --url https://en.wikipedia.org/wiki/Artificial_intelligence --conversation-config path/to/custom_config.yamlFor contributing or active development, use the pre-built development image which includes tools like flake8 and pytest and mounts local code for live development.
docker pull ghcr.io/souzatharsis/podcastfy:devgit clone https://github.com/souzatharsis/podcastfy.git
cd podcastfy
docker-compose up podcastfy-devAlternatively, you can build the development image locally using:
docker-compose build podcastfy-devThe development container exposes port 8001.
docker pull ghcr.io/souzatharsis/podcastfy:dev
git clone https://github.com/souzatharsis/podcastfy.git
cd podcastfy
docker-compose up podcastfy-devPodcastify provides a FastAPI implementation to serve podcast generation functionality via a REST API. This implementation supports podcast generation endpoints, audio file serving, configuration merging, and environment variable handling.
To use this implementation, you will need to refer to the example provided in usage/fast_api_example.py for a concrete implementation pattern.