TL;DR
GenSlide is an open-source project that turns text into PowerPoint slides: a language model writes each slide as JSON, and python-pptx builds the deck. This guide explains how its first version and its newer LangGraph pipeline work, with a deck builder you can run today. The model handles the bullet cutting, so you keep the fun part of checking every number.
How the deck gets made, in three parts:
Say a team lead has a two-page project update and a meeting in an hour. The content is done; what is missing is the deck. Copying paragraphs into slides, cutting them into bullets and picking titles is slow, repetitive work, and it is exactly the kind of work a language model handles well.
GenSlide is an open-source project by Mehdi Mohammadi that turns text into PowerPoint slides with a large language model (LLM). The idea is simple: ask the model to summarize the text as structured JSON, one object per slide, then use the python-pptx library to build a .pptx file from that JSON. This guide explains how GenSlide works, what changed between its first version and the current one, and walks through a working deck builder in Python that you can run today.
Key Takeaways
- GenSlide converts text into a PowerPoint deck in two steps: an LLM writes the slide content as JSON, and python-pptx turns that JSON into a .pptx file.
- The first version (v0.1.0, July 2024) ran Llama 3 8B Instruct locally through the gpt4all package, behind a Flask service and a Streamlit interface.
- The current version is an agentic pipeline built with LangGraph. It plans an outline, writes slides in parallel, accepts PDF and DOCX input, and lets a person approve or request revisions.
- The most important part is the contract between the model and your code: a strict JSON format, validated before anything is built.
- A model can summarize and structure text, but a person still needs to check the numbers and claims on every slide.
What Is GenSlide?
GenSlide is an MIT-licensed Python project on GitHub that generates PowerPoint slides from text. Its author, Mehdi Mohammadi, described the first version step by step in a Towards Data Science tutorial in 2024.
An LLM-powered app like this one is a program where a language model does one specific job inside ordinary code. Here, the model’s job is to read text and decide what goes on each slide. Everything else, from saving files to laying out slides, is regular Python.
How the First Version Worked
The v0.1.0 release has three parts, and the split is a good pattern for any app like it:
- An LLM service. A Flask app loads
Meta-Llama-3-8B-Instruct.Q4_0.ggufwith the gpt4all package, so the model runs on your own machine with no API key. It exposes one endpoint,/api/completion, that takes the text and returns the model’s reply. - A slide generator. It sends the text to that endpoint, parses the reply as JSON and passes it to a
SlideDeckclass built on python-pptx. - A Streamlit interface. You paste text into a box, and the generated .pptx file is saved in the
frontend/generatedfolder.
Running the model locally keeps your text on your machine and avoids per-request API costs. The trade-off is speed and quality: an 8B model with 4-bit quantization on a laptop CPU is slower and less reliable at following formatting rules than a large hosted model.
The Prompt That Defines the Slides
The core of v0.1.0 is its prompt. It asks the model to summarize the text into an array of JSON objects suitable for a presentation, to decide the number of slides from the length of the text, to keep each bullet to 10 words or fewer and to use at most 5 bullets per slide. The first object must be the title slide. The prompt includes examples of both shapes:
{"id": 1, "title_text": "My Presentation Title",
"subtitle_text": "My presentation subtitle", "is_title_slide": "yes"}
{"id": 2, "title_text": "Slide 1 Title", "text": ["Bullet 1", "Bullet 2"]} It ends with “Don’t output explanation. I just need the JSON array as your output.” That line exists because models like to add a friendly sentence before the JSON, which breaks a plain json.loads call.
Build a Text-to-Slides Generator in Python
The code below follows the same pattern as GenSlide v0.1.0 and runs as is. To keep it independent of any one model provider, it starts from a reply in GenSlide’s JSON format; in a real app, that string comes from your LLM call with the prompt above. Install the one dependency first:
pip install python-pptx import json
from pptx import Presentation
# What a model returns when asked for GenSlide's v0.1.0 JSON format:
# one title slide first, then one object per content slide.
llm_output = """
[
{"id": 1, "title_text": "Quarterly Support Review",
"subtitle_text": "Q3 results and next steps", "is_title_slide": "yes"},
{"id": 2, "title_text": "Ticket Volume",
"text": ["Tickets rose 12% over Q2", "Billing questions led the increase"]},
{"id": 3, "title_text": "Response Times",
"text": ["Median first reply: 3 hours", "Weekend backlog still too long",
"Target: under 2 hours by Q4"]}
]
"""
def parse_slides(raw: str) -> list[dict]:
"""Parse the model's reply and check the fields the deck builder needs."""
start, end = raw.find("["), raw.rfind("]")
slides = json.loads(raw[start:end + 1]) # ignore any text around the array
if not slides or slides[0].get("is_title_slide") != "yes":
raise ValueError("The first item must be the title slide.")
for slide in slides[1:]:
if not isinstance(slide.get("text"), list):
raise ValueError(f"Slide {slide.get('id')} has no bullet list.")
slide["text"] = slide["text"][:5] # GenSlide's prompt asks for at most 5 bullets
return slides
def build_deck(slides: list[dict], path: str) -> None:
prs = Presentation()
title_slide = prs.slides.add_slide(prs.slide_layouts[0]) # "Title Slide" layout
title_slide.shapes.title.text = slides[0]["title_text"]
title_slide.placeholders[1].text = slides[0].get("subtitle_text", "")
for item in slides[1:]:
slide = prs.slides.add_slide(prs.slide_layouts[1]) # "Title and Content" layout
slide.shapes.title.text = item["title_text"]
body = slide.placeholders[1].text_frame
body.text = item["text"][0]
for bullet in item["text"][1:]:
body.add_paragraph().text = bullet
prs.save(path)
slides = parse_slides(llm_output)
build_deck(slides, "support_review.pptx")
# Read the file back to confirm what was written.
for number, slide in enumerate(Presentation("support_review.pptx").slides, start=1):
print(number, slide.shapes.title.text) Output:
1 Quarterly Support Review
2 Ticket Volume
3 Response Times The result is a three-slide .pptx file (about 30 KB with python-pptx 1.0.2) that opens in PowerPoint, Keynote or Google Slides. Three details are worth copying into your own version:
- Cut the reply down to the JSON array. Taking the text between the first
[and the last]handles models that add a sentence before or after the array. - Validate before you build. Checking that the title slide comes first and that every slide has a bullet list turns a confusing python-pptx error into a clear message, which you can send back to the model to retry.
- Enforce the limits in code too. The prompt asks for at most five bullets, but models do not always comply, so the parser trims the list.
To connect a model, replace llm_output with the reply from your provider’s API or a local model, sending the GenSlide prompt followed by your text. Many hosted APIs also offer a JSON or structured output mode, which makes the parsing step more reliable. For more on writing instructions a model follows consistently, see our prompt engineering primer.
What Changed in the Current GenSlide
The main branch of GenSlide has since been rebuilt as an agentic system with LangGraph. According to the repository’s README, the pipeline now has these steps:
- An input parser reads plain text, PDF or DOCX files.
- An orchestrator agent plans the outline: between 5 and 10 slide titles that follow a logical order.
- A content agent writes the bullets and speaker notes for each slide, making its model calls in parallel.
- A builder node assembles the .pptx file with python-pptx and a navy and ice-blue theme.
- A human approval step in Streamlit lets you approve the deck or type revision notes, such as “add a pricing slide”, which send the work back to the orchestrator.
You can choose the model with an environment variable: LLM_PROVIDER=openai uses GPT-4o with an OpenAI API key, and LLM_PROVIDER=local uses the same local Llama 3 model through gpt4all. If you want to understand the loop behind designs like this, our guide to implementing AI agents in Python builds one from scratch.
The split into planner and writer solves a real problem with the single-prompt approach. One prompt has to decide the structure and write every bullet at once, and a weaker model often loses track of one or the other. Planning first, then writing each slide separately, gives each call a simpler job.
How to Run GenSlide
The current README lists these steps, using Python 3.10 or later:
git clone https://github.com/mehdimo/GenSlide
cd GenSlide
python -m venv ./venv
source ./venv/bin/activate
pip install -r requirements.txt
# in a .env file: LLM_PROVIDER=local, or LLM_PROVIDER=openai plus OPENAI_API_KEY
streamlit run frontend/ui.py The interface opens at http://localhost:8501. Finished decks are saved in frontend/generated/ with the revision number and a timestamp in the file name. If you prefer the simpler single-model design described in the original tutorial, check out the v0.1.0 tag instead.
Limits to Plan For
- Accuracy. Summarizing means choosing what to drop and how to phrase it. A model can round a number, merge two points or state a guess as a fact. Read every slide before you present it.
- Design. Both versions produce clean, text-first slides. Charts, diagrams and brand templates still need a person or extra code.
- Privacy. With a hosted model, your text is sent to that provider. The local option keeps it on your machine.
- Format drift. Even with clear instructions, models sometimes return broken JSON. Validation and a retry, as in the example above, keep a bad reply from crashing the app.
Back to the Project Update
For the team lead with a meeting in an hour, the two-page update becomes a first draft deck in one run: a title slide, a handful of content slides with short bullets and, in the current GenSlide, speaker notes. The remaining time goes to the part a model cannot do for them, checking that every number is right and that the story fits the room.
Frequently Asked Questions
Is GenSlide Free to Use?
Yes. GenSlide is open source under the MIT license. Running it with the local model costs nothing beyond your own hardware, while the OpenAI option is billed by OpenAI based on usage.
Does GenSlide Need an Internet Connection?
Only to install it, download the local model the first time, or call a hosted model. With LLM_PROVIDER=local, generation runs on your machine after the model is downloaded.
Can I Use a Different LLM With GenSlide?
The current version supports OpenAI’s GPT-4o and local models through gpt4all, chosen in the .env file. Because the code is open source, you can add another provider in the module that creates the model, as long as it returns the JSON the agents expect.
Can GenSlide Read PDF Files?
The current version accepts plain text, PDF and DOCX files. The original v0.1.0 version accepted only text pasted into the interface.





