AI Presentation Generator

AI Presentation Generator

Building presentations takes forever. What if you could skip the tedious parts and let AI do the heavy lifting?

#YOUTUBE(QoF1YJ-iRSc)#

In this guide, I’ll show you how to build your own presentation generator. I’ve included the exact prompt I used at the end of this article.

Here’s what you need to do:

  • Use Cursor AI code editor to create a presentation generator using the prompt below
  • Set up your API keys:
    • Get an OpenAI API key for text and image prompts, and save it to ~/.mingdaoai/openai.key
    • Get a Replicate API key, and save it to ~/.mingdaoai/replicate.key
  • Write your presentation outline in a markdown file
  • Run the scripts to generate your presentation:
    • Step 1: Turn your outline into titles and image prompts
    • Step 2: Generate images for each slide
    • Step 3: Combine titles and images into slides
    • Step 4: Combine all slides into a final presentation

Cursor AI Prompt

Save the following sections to a file called content.md, then let Cursor AI generate the code for you.

Overview

The presentation system has four scripts:

  1. present1_content_generator.py - Creates slide content with titles, speaker notes, and image prompts
  2. present2_image_generator.py - Generates images for each slide using the prompts
  3. present3_image_text_composer.py - Combines images and text into final slides
  4. present4_video_generator.py - Turns the slides into a video presentation

Files You Need

Before running the scripts, make sure you have these files in your presentation folder:

  1. present.md - Your presentation outline and requirements
  2. present_format.json - Settings like dimensions and layout

Script Details

1. Content Generator (present1_content_generator.py)

# What it does:
- SlideContent class stores slide data
- SlideContentGenerator uses OpenAI API to create content
- Supports Chinese and English
- Creates titles, speaker scripts, and image prompts
- Saves everything to present_content.txt

2. Image Generator (present2_image_generator.py)

# What it does:
- SlideImageGenerator handles image creation
- Uses mutil.genPictureUtil for generating images
- Can process one slide or batch generate
- Checks that images and prompts are valid
- Saves images as webp files

3. Image Text Composer (present3_image_text_composer.py)

# What it does:
- Puts images and text together on slides
- Handles layout and positioning
- Supports different presentation styles
- Creates high-quality slide images

4. Video Generator (present4_video_generator.py)

# What it does:
- Turns slides into a video
- Adds transitions and timing
- Can add background music
- Outputs the final video

How to Use It

  1. Create a present.md file with your presentation outline
  2. Create a present_format.json file with your preferred dimensions
  3. Run the scripts in order:
    python present1_content_generator.py
    python present2_image_generator.py
    python present3_image_text_composer.py
    python present4_video_generator.py
    

Requirements

  • Python 3.8 or newer
  • OpenAI API key (saved to ~/.mingdaoai/openai.key)
  • Python packages you’ll need:
    • openai
    • Pillow
    • pathlib
    • typing
    • json
    • argparse

What You Get

The scripts create these files:

  1. present_content.txt - All slide content
  2. images/ folder - Generated images
  3. present_*.webp - Individual slide images
  4. present_*_prompt.json - Image prompts in JSON format
  5. present_*_prompt.txt - Image prompts as plain text
  6. Final video file