A Streamlit web app that leverages Google’s Gemini generative AI to create professional PowerPoint presentations automatically from a topic input. The app can generate slide outlines and content, optionally enhancing slides with related images fetched from the Pexels API.
- Generate presentation slide outlines with AI based on any topic.
- Customize number of slides.
- Optionally include relevant stock images using Pexels.
- Use multiple Gemini models (Pro, Flash, etc.) for different speed and quality preferences.
- Download fully formatted PowerPoint (.pptx) files.
- Debug mode to show raw AI generation output for troubleshooting.
- Python 3.8 or higher
- Google Gemini API key with access to generative AI models.
- (Optional) Pexels API key to fetch stock images.
- Clone the repository:
git clone <repository-url>
cd powerpoint-generator- Install required dependencies:
pip install -r requirements.txt- Set up environment variables:
# Create a .env file in the project root
GEMINI_API_KEY=your_gemini_api_key_here
PEXELS_API_KEY=your_pexels_api_key_heregoogle-generativeai
python-pptx
requests
python-dotenv
- Visit Google AI Studio
- Sign in with your Google account
- Create a new API key
- Copy the key to your
.envfile
- Visit Pexels API
- Sign up for a free account
- Generate an API key
- Copy the key to your
.envfile
from powerpoint_generator import PowerPointGenerator
# Initialize the generator
generator = PowerPointGenerator()
# Generate a presentation
presentation = generator.create_presentation(
topic="Climate Change",
num_slides=5
)
# Save the presentation
presentation.save("climate_change_presentation.pptx")python generate_presentation.py --topic "Your Topic" --slides 5 --output "presentation.pptx"powerpoint-generator/
├── README.md
├── requirements.txt
├── .env.example
├── generate_presentation.py
├── powerpoint_generator/
│ ├── __init__.py
│ ├── generator.py
│ ├── gemini_client.py
│ └── pexels_client.py
└── examples/
└── sample_presentation.pptx
The application uses the following default settings:
- Gemini Model: gemini-2.0-flash-exp (or gemini-1.5-pro as fallback)
- Image Resolution: 1920x1080 (landscape)
- Max Images per Slide: 1
- Content Language: English
- Free tier: 15 requests per minute
- Rate limiting is handled automatically
- Free tier: 200 requests per hour
- 20,000 requests per month
- Fork the repository
- Create a feature branch (
git checkout -b feature/new-feature) - Commit your changes (
git commit -am 'Add new feature') - Push to the branch (
git push origin feature/new-feature) - Create a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
API Key Errors
- Ensure your API keys are correctly set in the
.envfile - Verify that your API keys are active and have sufficient quota
Image Download Failures
- Check your internet connection
- Verify Pexels API key is valid
- Some images may not be available in the requested resolution
PowerPoint Generation Errors
- Ensure you have write permissions in the output directory
- Check that all required dependencies are installed
- Google Gemini for AI content generation
- Pexels for providing free stock photography
- python-pptx for PowerPoint file manipulation
For issues and questions, please open an issue on the GitHub repository or contact the maintainers.