OpenAI acquires presentation startup NextSlide
Back to Tutorials
aiTutorialintermediate

OpenAI acquires presentation startup NextSlide

August 9, 202612 views4 min read

Learn to build an AI-powered presentation generator that creates slide decks from text topics using OpenAI's API, similar to the technology NextSlide was developing before its acquisition.

Introduction

In this tutorial, you'll learn how to integrate presentation generation capabilities into your applications using AI-powered tools similar to what NextSlide was developing before its acquisition by OpenAI. We'll build a Python application that can automatically generate slide decks from text content using the OpenAI API. This demonstrates the core technology that NextSlide was working on, but now integrated directly into ChatGPT's ecosystem.

Prerequisites

  • Python 3.7 or higher installed on your system
  • Basic understanding of Python programming
  • OpenAI API key (you can get one from OpenAI's platform)
  • Basic knowledge of REST APIs and HTTP requests

Step-by-step instructions

1. Setting up the Development Environment

1.1 Create a new Python project directory

First, create a new directory for our project and navigate into it:

mkdir presentation_generator
 cd presentation_generator

1.2 Install required dependencies

We'll need the OpenAI Python library and some additional tools for handling the presentation generation:

pip install openai python-pptx

2. Configuring the OpenAI API

2.1 Create environment variables

Create a file called .env in your project directory to store your API key securely:

OPENAI_API_KEY=your_api_key_here

2.2 Load environment variables in Python

Create a config.py file to handle the API configuration:

import os
from dotenv import load_dotenv

load_dotenv()

OPENAI_API_KEY = os.getenv('OPENAI_API_KEY')

3. Creating the Presentation Generator Class

3.1 Initialize the main generator class

Create a presentation_generator.py file with the core functionality:

import openai
from config import OPENAI_API_KEY
import json

class PresentationGenerator:
    def __init__(self):
        openai.api_key = OPENAI_API_KEY
        
    def generate_outline(self, topic, num_slides=5):
        prompt = f"Generate a presentation outline for {topic} with {num_slides} slides. \
        Return only the JSON format with 'slides' array containing slide titles and content."
        
        response = openai.ChatCompletion.create(
            model="gpt-3.5-turbo",
            messages=[
                {"role": "system", "content": "You are a presentation expert. Generate clear, concise slide outlines."},
                {"role": "user", "content": prompt}
            ],
            temperature=0.7,
            max_tokens=1000
        )
        
        # Parse the JSON response
        try:
            result = json.loads(response.choices[0].message.content)
            return result['slides']
        except json.JSONDecodeError:
            # If JSON parsing fails, return raw content
            return [{'title': 'Error', 'content': response.choices[0].message.content}]

3.2 Add slide creation functionality

Extend the class to create actual PowerPoint slides:

from pptx import Presentation
from pptx.util import Inches
from pptx.dml.color import RGBColor
from pptx.enum.text import PP_ALIGN

    def create_presentation(self, slides_data, filename="generated_presentation.pptx"):
        # Create a new presentation
        prs = Presentation()
        
        # Set slide dimensions (standard 16:9)
        prs.slide_width = Inches(13.33)
        prs.slide_height = Inches(7.5)
        
        # Add title slide
        title_slide_layout = prs.slide_layouts[0]
        slide = prs.slides.add_slide(title_slide_layout)
        title = slide.shapes.title
        subtitle = slide.placeholders[1]
        
        title.text = "Presentation on " + slides_data[0]['title']
        subtitle.text = "Generated by AI"
        
        # Add content slides
        for slide_data in slides_data[1:]:
            content_slide_layout = prs.slide_layouts[1]
            slide = prs.slides.add_slide(content_slide_layout)
            
            title_shape = slide.shapes.title
            title_shape.text = slide_data['title']
            
            content_shape = slide.placeholders[1]
            content_shape.text = slide_data['content']
            
        # Save the presentation
        prs.save(filename)
        print(f"Presentation saved as {filename}")

4. Building the Main Application

4.1 Create the main execution script

Create a main.py file that ties everything together:

from presentation_generator import PresentationGenerator

def main():
    # Initialize the generator
    generator = PresentationGenerator()
    
    # Get topic from user
    topic = input("Enter the presentation topic: ")
    
    # Generate outline
    print("Generating presentation outline...")
    slides = generator.generate_outline(topic, num_slides=5)
    
    # Display the outline
    print("\nGenerated Outline:")
    for i, slide in enumerate(slides, 1):
        print(f"{i}. {slide['title']}")
        print(f"   {slide['content']}")
        print()
    
    # Create the presentation
    filename = f"{topic.replace(' ', '_')}_presentation.pptx"
    generator.create_presentation(slides, filename)
    
    print(f"\nPresentation created successfully: {filename}")

if __name__ == "__main__":
    main()

5. Running the Application

5.1 Set up your environment

Before running, make sure you have your API key in the .env file and all dependencies installed:

pip install python-dotenv

5.2 Execute the application

Run your application:

python main.py

5.3 Test with sample input

When prompted, enter a topic like "Machine Learning Fundamentals" and observe how the AI generates a structured presentation outline that gets converted into a PowerPoint file.

Summary

In this tutorial, you've built a presentation generation tool that leverages OpenAI's language models to automatically create slide decks from text topics. The application demonstrates the core technology that NextSlide was developing before its acquisition by OpenAI. You learned how to:

  • Set up an OpenAI API integration
  • Generate structured content using AI prompts
  • Parse and format AI responses into presentation data
  • Create actual PowerPoint files programmatically

This approach mirrors what NextSlide was working on, but now integrated directly into ChatGPT's ecosystem. The technology allows for rapid content creation and presentation generation, which is exactly what the acquisition was aimed at improving. By understanding how to build such tools, you're now equipped to create similar AI-powered presentation solutions that can be used in business, education, and personal productivity contexts.

Related Articles