This application provides an API to generate, configure, and download presentations dynamically. It uses Flask for the API server and Python's pptx
library to create PowerPoint presentations. I have added some sample presentation generated uing the api which are in the presentatins folder inside the main directory(SlideGeneratorAPI).
- Create presentations with a configurable number of slides and layouts.
- Configure and update presentations after creation.
- Download generated presentations.
- Built-in rate-limiting for API requests.
- I have tested all endpoints of the APIs using the postman.
-
Clone the repository:
git clone https://github.com/Sahilkumar19/Slide-Generator-API.git cd Slide-Generator-API
-
Install dependencies:
pip install -r requirements.txt
-
Set up an environment variable for the Gemini API key (optional):
export GEMINI_API_KEY="your-api-key"
Or replace the
GEMINI_API_KEY
variable in the code directly. -
Run the application:
python app.py
-
Use a REST client (e.g., Postman) to interact with the API.
POST /api/v1/presentations
{
"topic": "<topic-name>",
"config": {
"num_slides": 10,
"layout": "bullet_points",
"theme": { "background_color": "#FFFFFF" }
}
}
{
"id": "<presentation-id>",
"message": "Presentation created successfully"
}
GET /api/v1/presentations/<presentation_id>
{
"id": "<presentation-id>",
"topic": "<topic-name>",
"config": { "num_slides": 10 },
"created_at": "<timestamp>",
"file_path": "<path-to-file>"
}
GET /api/v1/presentations/<presentation_id>/download
Downloads the generated presentation as a .pptx
file.
POST /api/v1/presentations/<presentation_id>/configure
{
"num_slides": 5,
"layout": "two_column"
}
{
"message": "Presentation configuration updated successfully"
}