Skip to content

akshaymegharaj/slide-generator

Repository files navigation

Slide Generator API

Generate customizable presentation slides using AI. Built with FastAPI, SQLite, and a modular, swappable architecture.

Features

  • AI-powered slide generation
  • Customizable themes & aspect ratios
  • Persistent SQLite storage
  • Fast in-memory caching
  • PPTX export
  • Modular, pluggable design
  • Interactive API docs (Swagger)

Sample Outputs

Check the sample_outputs/ folder for example PPTX files generated by the API.

Quick Start

git clone <repository-url>
cd slide-generator
python -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate
pip install -r requirements.txt
cp .env.example .env  # Add your OpenAI API key

Run the API

python -m app.main
# or
uvicorn app.main:app --reload

Visit localhost:8000/docs for interactive API docs.

Documentation

📚 Detailed documentation is available in the docs/ folder:

Key API Endpoints

  • POST /api/v1/presentations – Create presentation
  • GET /api/v1/presentations/{id} – Get presentation
  • GET /api/v1/presentations – List presentations
  • GET /api/v1/presentations/{id}/download – Download PPTX
  • POST /api/v1/presentations/{id}/configure – Update config

Example: Create a Presentation

curl -X POST "http://localhost:8000/api/v1/presentations" \
  -H "Content-Type: application/json" \
  -d '{"topic": "Machine Learning Basics", "num_slides": 5}'

Modular Architecture

  • Interfaces: Abstract contracts for LLM, cache, storage
  • Implementations: Pluggable (OpenAI, dummy LLM, Redis, etc.)
  • Factory pattern: Easy to swap components

Project Structure

app/
  apis/         # API routes
  config/       # Config & themes
  interfaces/   # Abstract interfaces
  middleware/   # Auth, rate limiting
  models/       # Data models
  services/     # Logic & implementations
  main.py       # Entry point

Configuration

  • .env for secrets and API keys
  • See docs/ENVIRONMENT_SETUP.md for details

Testing

The tests in the tests/ folder are integration tests that require the server to be running for successful execution.

# Start the server first (in one terminal)
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000

# Then run the tests (in another terminal)
python -m pytest tests/ -v

Note: These are integration tests that test the full API endpoints, not unit tests. They require the FastAPI server to be running to properly test the complete request-response cycle.

Future Scope

  1. Replace API calls with API + WebSocket or API + periodic lookup - Handle long response times by implementing real-time communication or polling mechanisms
  2. Allow changing LLM prompts from config - Enable dynamic prompt updates without requiring service restart
  3. Integrate LangChain for complex content generation flows - Implement sophisticated reasoning chains, multi-step content generation, and advanced prompt orchestration

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages