Loading repository dataβ¦
Loading repository dataβ¦
naakaarafr / repository
AI-powered storybook creator using 5 specialized agents to generate complete illustrated stories. Input any topic and get a professional 5-chapter book with custom FLUX.1-dev images, formatted as PDF/HTML. Perfect for parents, educators & storytellers! π€πβ¨
Create beautiful, illustrated storybooks about any topic using AI!
An intelligent multi-agent system that creates professional storybooks with custom illustrations. Perfect for parents, educators, and anyone who loves storytelling!
$ python main.py
π What topic would you like your storybook to be about?
π‘ Here are some popular topics for inspiration:
β’ Animals (farm animals, jungle animals, pets)
β’ Space and planets
β’ Friendship and kindness
[...]
βοΈ Enter your story topic: magical forest animals
π You chose: 'magical forest animals'
Is this correct? (y/n): y
π¨ Creating a wonderful storybook about 'magical forest animals' for you!
β³ This may take several minutes due to rate limiting...
Clone the repository:
git clone https://github.com/naakaarafr/Storybook-Generator.git
cd Storybook-Generator
Install dependencies:
pip install -r requirements.txt
Set up environment variables:
# Create a .env file or export directly
export GOOGLE_API_KEY="your_google_ai_api_key_here"
export HUGGINGFACE_API_KEY="your_huggingface_api_key_here"
Install PDF tools (optional but recommended):
# Option 1: WeasyPrint (recommended)
pip install weasyprint
# Option 2: mdpdf
pip install mdpdf
# Option 3: pdfkit + wkhtmltopdf
pip install pdfkit
# Then install wkhtmltopdf from https://wkhtmltopdf.org/downloads.html
Run the generator:
python main.py
GOOGLE_API_KEY environment variableHUGGINGFACE_API_KEY environment variableThe system uses 5 specialized AI agents in a sequential workflow:
graph LR
A[Story Outliner] --> B[Story Writer]
B --> C[Image Generator]
C --> D[Content Formatter]
D --> E[PDF Converter]
π Story Outliner
βοΈ Story Writer
π¨ Image Generator
π Content Formatter
π PDF Converter
storybook-generator/
βββ agents.py # AI agent definitions
βββ config.py # Configuration and rate limiting
βββ crew.py # CrewAI crew setup
βββ main.py # Main application entry point
βββ tasks.py # Task definitions for agents
βββ tools.py # Custom tools and utilities
βββ template.md # Story template (auto-generated)
βββ requirements.txt # Python dependencies
βββ README.md # This file
βββ output/
βββ story.md # Generated markdown story
βββ story.pdf # Generated PDF (if conversion succeeds)
βββ story.html # Enhanced HTML version
βββ *.png # Generated illustrations
The system includes intelligent rate limiting for API calls:
You can customize the system by modifying:
config.py: API settings and rate limitsagents.py: Agent behaviors and goalstasks.py: Task descriptions and requirementstools.py: Image generation and PDF conversionAfter successful generation, you'll find:
Try these engaging topics:
Animals & Nature:
Space & Science:
Fantasy & Magic:
Everyday Adventures:
β "No PDF conversion tools found"
# Install one of these:
pip install weasyprint # Recommended
pip install mdpdf # Alternative
pip install pdfkit # Requires wkhtmltopdf
β "Rate limit exceeded"
β "Image generation failed"
β "Font errors with WeasyPrint"
Create a .env file in the project root:
GOOGLE_API_KEY=your_google_ai_api_key_here
HUGGINGFACE_API_KEY=your_huggingface_api_key_here
crewai>=0.28.0
langchain-google-genai>=1.0.0
pillow>=9.0.0
requests>=2.28.0
markdown>=3.4.0
# PDF conversion (choose one or more)
weasyprint>=60.0 # Recommended
mdpdf>=1.0.0 # Alternative
pdfkit>=1.0.0 # Requires wkhtmltopdf
Contributions are welcome! Here are some ways you can help:
# Clone and setup
git clone https://github.com/naakaarafr/storybook-generator.git
cd storybook-generator
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install in development mode
pip install -e .
pip install -r requirements-dev.txt # If it exists
This project is licensed under the MIT License - see the LICENSE file for details.
Future enhancements planned: