No project description provided
Project description
Document-to-podcast: a Blueprint by Mozilla.ai for generating podcasts from documents using local AI
This blueprint demonstrate how you can use open-source models & tools to convert input documents into a podcast featuring two speakers. It is designed to work on most local setups or with GitHub Codespaces, meaning no external API calls or GPU access is required. This makes it more accessible and privacy-friendly by keeping everything local.
👉 📖 For more detailed guidance on using this project, please visit our Docs here.
Built with
- Python 3.10+ (use Python 3.12 for Apple M1/2/3 chips)
- Llama-cpp (text-to-text, i.e script generation)
- OuteAI / Parler_tts (text-to-speech, i.e audio generation)
- Streamlit (UI demo)
Quick-start
Get started with Document-to-Podcast using one of the two options below: GitHub Codespaces for a hassle-free setup or Local Installation for running on your own machine.
Option 1: GitHub Codespaces
The fastest way to get started. Click the button below to launch the project directly in GitHub Codespaces:
Once the Codespaces environment launches, inside the terminal, start the Streamlit demo by running:
python -m streamlit run demo/app.py
Option 2: Local Installation
-
Clone the Repository Inside the Codespaces terminal, run:
git clone https://github.com/mozilla-ai/document-to-podcast.git cd document-to-podcast
-
Install Dependencies Inside the terminal, run:
pip install -e .
-
Run the Demo Inside the terminal, start the Streamlit demo by running:
python -m streamlit run demo/app.py
NOTE: The first time you run the demo app it might take a while to generate the script or the audio because it will download the models to the machine which are a few GBs in size.
How it Works
-
Document Input Start by either:
- Uploading a document in a supported format (e.g., PDF, .txt, or .docx)
- Entering a website URL to fetch content directly
-
Document Pre-Processing The input is processed to extract and clean the text. This involves:
- Extracting readable text from the document or webpage
- Removing noise such as URLs, email addresses, and special characters to ensure the text is clean and structured
-
Script Generation The cleaned text is passed to a language model to generate a podcast transcript in the form of a conversation between two speakers.
- Model Loading: The system selects and loads a pre-trained LLM optimized for running locally, using the llama_cpp library. This enables the model to run efficiently on CPUs, making them more accessible and suitable for local setups.
- Customizable Prompt: A user-defined "system prompt" guides the LLM in shaping the conversation, specifying tone, content, speaker interaction, and format.
- Output Transcript: The model generates a podcast script in structured format, with each speaker's dialogue clearly labeled.
Example output:
{ "Speaker 1": "Welcome to the podcast on AI advancements.", "Speaker 2": "Thank you! So what's new this week for the latest AI trends?", "Speaker 1": "Where should I start.. Lots has been happening!", ... }
This step ensures that the podcast script is engaging, relevant, and ready for audio conversion.
-
Audio Generation
- The generated transcript is converted into audio using a Text-to-Speech (TTS) model.
- Each speaker is assigned a distinct voice.
- The final output is saved as an audio file in formats like MP3 or WAV.
Models
The architecture of this codebase focuses on modularity and adaptability, meaning it shouldn't be too difficult to swap frameworks to use your own suite of models. We have selected fully open source models that are very memory efficient and can run on a laptop CPU with less than 10GB RAM requirements.
text-to-text
We are using the llama.cpp library, which supports open source models optimized for local inference and minimal hardware requirements. The default text-to-text model in this repo is the open source OLMoE-7B-Instruct from AllenAI.
For the complete list of models supported out-of-the-box, visit this link.
text-to-speech
We support models from the OuteAI and Parler_tts packages. The default text-to-speech model in this repo is OuteTTS-0.2-500M. Note that the 0.1-350M version has a CC-By-4.0 (permissive) license, whereas the newer / better 0.2-500M version has a CC-By-NC-4.0 (non-commercial) license.
For a complete list of models visit Oute HF (only the GGUF versions) and Parler HF.
Important note: In order to keep the package dependencies as lightweight as possible, only the Oute interface is installed by default. If you want to use the parler models, please also follow the instructions at https://github.com/huggingface/parler-tts.
Pre-requisites
-
System requirements:
- OS: Windows, macOS, or Linux
- Python 3.10>, <3.12
- Minimum RAM: 10 GB
- Disk space: 32 GB minimum
-
Dependencies:
- Dependencies listed in
pyproject.toml
- Dependencies listed in
Troubleshooting
When starting up the codespace, I get the message
Oh no, it looks like you are offline!
If you are on Firefox and have Enhanced Tracking Protection On, try turning it Off for the codespace webpage.
During the installation of the package, it fails with
ERROR: Failed building wheel for llama-cpp-python
You are probably missing the GNU Make package. A quick way to solve it is run on your terminal sudo apt install build-essential
License
This project is licensed under the Apache 2.0 License. See the LICENSE file for details.
Contributing
Contributions are welcome! To get started, you can check out the CONTRIBUTING.md file.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file document_to_podcast-1.1.1.tar.gz.
File metadata
- Download URL: document_to_podcast-1.1.1.tar.gz
- Upload date:
- Size: 2.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e0d1ca5f8cb62dddb2ef30afd34910b0245c9af9229318d85f1993a1f8b1cb29
|
|
| MD5 |
62acf6ec35ce68bbaec5eb9e707f7892
|
|
| BLAKE2b-256 |
2acab6820ea173d8a6920c33f8544f0cd70529b11c50d798ed6f36fa56750903
|
Provenance
The following attestation bundles were made for document_to_podcast-1.1.1.tar.gz:
Publisher:
release.yaml on mozilla-ai/document-to-podcast
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
document_to_podcast-1.1.1.tar.gz -
Subject digest:
e0d1ca5f8cb62dddb2ef30afd34910b0245c9af9229318d85f1993a1f8b1cb29 - Sigstore transparency entry: 161124380
- Sigstore integration time:
-
Permalink:
mozilla-ai/document-to-podcast@faf5f9af933b7dbaee25ca4f0dd2992e14ee2be7 -
Branch / Tag:
refs/tags/1.1.1 - Owner: https://github.com/mozilla-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@faf5f9af933b7dbaee25ca4f0dd2992e14ee2be7 -
Trigger Event:
release
-
Statement type:
File details
Details for the file document_to_podcast-1.1.1-py3-none-any.whl.
File metadata
- Download URL: document_to_podcast-1.1.1-py3-none-any.whl
- Upload date:
- Size: 18.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0f911c58451b73f8e986bc75a83b84d24555f130011b71ddd90e1cf4e0f8159b
|
|
| MD5 |
2114a0011f7e2bbf844ebeee13dc86e7
|
|
| BLAKE2b-256 |
5e9b0e1dac7882aa23677192bec1e9fdfa4265dd8839bc9c00fae2976b6e36d5
|
Provenance
The following attestation bundles were made for document_to_podcast-1.1.1-py3-none-any.whl:
Publisher:
release.yaml on mozilla-ai/document-to-podcast
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
document_to_podcast-1.1.1-py3-none-any.whl -
Subject digest:
0f911c58451b73f8e986bc75a83b84d24555f130011b71ddd90e1cf4e0f8159b - Sigstore transparency entry: 161124382
- Sigstore integration time:
-
Permalink:
mozilla-ai/document-to-podcast@faf5f9af933b7dbaee25ca4f0dd2992e14ee2be7 -
Branch / Tag:
refs/tags/1.1.1 - Owner: https://github.com/mozilla-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@faf5f9af933b7dbaee25ca4f0dd2992e14ee2be7 -
Trigger Event:
release
-
Statement type: