How to use AI to create a PowerPoint presentation?
![blog preview](/_next/image?url=%2Fblog%2FBlogHeader_AiPptx.jpg&w=3840&q=75)
Creating effective PowerPoint presentations is an important skill for professionals and students alike. Well-designed slides can help engage your audience and clearly communicate your message. While it still takes careful planning and an understanding of your audience to make a great presentation, AI might be able to help with the more time consuming, but less important aspects of the process.
Large Language Models (LLMs) like GPT-4, developed by companies like OpenAI, are one example of an AI technology that could potentially assist with presentation creation. These models can generate human-like text based on prompts, which might be useful for brainstorming content ideas or fleshing out speaker notes.
While these Use-Cases are quite mainstream - using ChatGPT to generate presentation ideas, it's ability to generate code snippets might be useful to not only create the text snippets for a presentation - but the full presentation itself.
In this blog post we are going to explore the capabilities of using GPT-4 to create a fully-fledged PowerPoint presentation. Not only that - we are also showing you how to leverage GPT-4 to use your company's PowerPoint template and therefore stick to your company's design guidelines.
How to use GPT-4 to create a PowerPoint presentation
What we are going to build
To demonstrate and validate GPT-4s capabilities in creating PowerPoint presentations and even using corporate design guidelines, we are going to build a small python script that generates a PowerPoint presentation based on given prompts.
While this might already impress some of our readers, the more experienced AI professionals might rightfully ask: "How do you make sure that the PowerPoint presentation is about the right topic?". This is a more than valid question - as GPT-4 in general might not know the specifics of your company or topic - and therefore might hallucinate some content.
To mitigate this risk - and in general provide GPT-4 with the information it needs - we are going to connect our PowerPoint generator with a small Retrieval Augmented Generation pipeline. As the latter allows us to safely and reliably connect GPT-4 with our company's data.
Outline for using GPT-4 to create PowerPoint presentations
The system we are going to implement is summarized in the following steps:
-
We create a small python script that connects to the OpenAI API and allows us to get answers from GPT-4 by providing a prompt.
-
We create a small Retrieval Augmented Generation pipeline which allows us to retrieve relevant information and data from our company's data sources.
-
We create a prompt that asks GPT-4 to generate a PowerPoint presentation based on provided information. We ask GPT-4 to use a package called
python-pptx
to create the PowerPoint presentation.python-pptx
is a python package that allows you to create PowerPoint presentations programmatically. It is a great tool to create PowerPoint presentations from scratch or to modify existin presentations. -
We connect the 3 previous components as follows:
a. We use the user prompt - so the specification of what the presentation should be about - to query the Retrieval Augmented Generation pipeline.
b. We use the output of the Retrieval Augmented Generation pipeline and send it to GPT-4. We use a prompt asking to generate a
python-pptx
-powered python script that creates a PowerPoint presentation.c. We execute the generated python script and create the PowerPoint presentation.
-
As an add-on, we'll evaluate, whether we are able to use existing PowerPoint templates to create the presentation - and stick to corporate design guidelines.
Retrieval Augmented Generation enhanced PowerPoint creation with AI
Preparation
As we make use of the programming capabilities of GPT-4, we require a working python 3.11 environment. We recommend using a virtual environment to keep your dependencies clean.
Other then that, you just need:
- A PowerPoint 2007 or newer installation
- A PowerPoint template file
- An OpenAI api key
Install the required python packages by running:
Implementation of the PowerPoint generator
As creating the presentation itself is the most critical part, we are going to start with that aspect.
To not overwhelm the AI with too many tasks in one go, we divide the challenge into two parts:
- Structuring the information into presentation material
- Using that material to create the presentation
- Import the required packages:
-
Create a prompt template that asks GPT-4 to structure the provided information into presentation material:
NOTE: There are several ways for asking GPT-4 to return JSON objects. One of them would be function calling or
llama_index'
structured prediction functionalities. However, as of time of this writing, there was a problem with GPT-4 where function calling was not working reliably, that's why we opted for the few-shot prompt above. -
Let's create some test information and test topic to test the prompt. We will change this later on to use the output of the retrieval augmented generation pipeline.
-
Create the LLM inference code
The output of this call should be a JSON formatted text, containing a list of slides with titles and content.
-
Create another LLM inference pipeline, that uses these information to create a PowerPoint slide-deck.
-
Execute the generated python code to create the PowerPoint presentation.
This will create a file called
presentation.pptx
in the current working directory. Have a look at the file to see the generated presentation.Quite impressive right? We are able to generate PowerPoint presentations based on a given topic and information - all automatically from an AI.
So far so good, up until now we know how to utilize GPT-4 to create a PowerPoint presentation, when presented with a topic and some information.
Next, instead of providing hard-coded information, let's use the retrieval augmented generation pipeline to provide the information to GPT-4.
Implement the retrieval augmented generation pipeline
In this next section, we are going to simulate our companies data repository by using a simple directory. We assume, our companies documents are all stored there.
We are going to use the llama_index
package to index the documents and
retrieve the relevant information for the topic we want to create presentations
for.
As example document we are using a very well-known Paul Graham essay about his life - and ask GPT-4 to create a presentation on Paul Graham.
-
Download the sample document
-
Load all files in our directory
-
Now that we created our vector store, we can use it to retrieve information relevant for our presentation. For that, let's set up our embedding model as well as our vector retriever.
NOTE: In this guide we assume you know how RAG works. For a primer to what RAG is and how it works, see here
-
And finally, we can define our topic, and find all relevant information for it.
relevant_information
contains information related to the specified topic about Paul Grahams life.
Combining the RAG pipeline with PowerPoint creation
We are getting somewhere, aren't we? We know, how to create presentations and we know how to efficiently retrieve information for this presentation. Let's stick it together. This is rather easy, as we can reuse code from the previous sections.
Isn't that amazing? We just created a quite monumental presentation about Paul Grahams life in about 10 seconds.
I'll give you that - it's not the most enticing presentation of all time and it probably needs some minor refinements. But - it's definitely incredibly helpful to get a presentation with all relevant (and factual correct!) information as a starting point.
One thing however which is kinda annoying and hinders further productive use is the lack of styling and corporate design. Let's fix this quickly.
Use GPT-4 to create PowerPoint presentation with corporate design
So, the holy grail, creating PowerPoint presentation with corporate design. First things first, we will now convince GPT-4 to design a PowerPoint presentation based on our written input.
However, we will be able to use a PowerPoint template as base presentation - GPT-4 then adds the content to this template. This is factually the same result - a presentation designed in our corporate design language.
-
Create a PowerPoint template and save it in your current working directory as 'template.pptx'.
-
Slighly change the PowerPoint creation prompt as follows
-
Run the code again.
That's it. All we needed was to tell GPT-4 to actually use our template - and it happily obliged. I like it when life's that simple.
And the output looks absolutely stunning. We have a presentation about Paul Graham in our corporate design language. And all of that in less than 10 seconds.
Paul Graham presentation in corporate design
NOTE: If you get an error "Package not found" when running the last line in the code example, its because the "template.pptx" is not in the same location as where you run the script. Make sure to move the template to the correct location.
Conclusion
In summary, using AI tools like GPT-4 to create PowerPoint presentations can save time and ensure that slides follow your company's design templates. This blog post showed a reliable way to use GPT-4 to automatically make presentations that look good and have relevant content, based on your company's slide templates. By using AI to help make presentations, you can spend more time on delivering your message instead of manually putting together slides. AI can generate content that fits the context and, when combined with fact-checking against reliable sources, will produce slides that are not only visually appealing but also accurate and on-topic. This method saves time and uses AI's capabilities to improve the overall quality of business presentations. As AI keeps advancing, using it for common work tasks like making PowerPoint slides is changing how we create and share information, making AI a valuable tool for professional communication.
As AI keeps getting better, it will keep being used for everyday tasks like this. It will make things more efficient and also give us new ways to be creative and personalize how we share ideas through presentations.
Further Reading
- How to save on LLM costs?
- Chat with your Confluence Data
- GenAI: Technological Masterpiece or Ecological Disaster?
------------------
Interested in how to train your very own Large Language Model?
We prepared a well-researched guide for how to use the latest advancements in Open Source technology to fine-tune your own LLM. This has many advantages like:
- Cost control
- Data privacy
- Excellent performance - adjusted specifically for your intended use