AI-powered children's picture book generator for ages 3-5
This is a gift from Cloud Dad to his daughter, Cloud.
Every child deserves their own unique story. StoryCraft harnesses the power of AI to weave imaginative worlds for children, making bedtime warm and special.
May all children be surrounded by love and drift into sweet dreams accompanied by stories.
- AI Story Generation - Enter a creative idea, AI crafts a complete story
- Automatic Illustrations - Beautiful images for every page
- Bilingual Support - Chinese and English for language learning
- PDF Export - Optimized for Kindle e-readers and tablets
- 8 Art Styles - Manga, Anime, Chinese Traditional, Watercolor, and more
- Customizable - Edit stories, regenerate images, personalize content
Perfect for: Parents creating personalized books, educators making teaching materials, anyone crafting unique stories for children
- Python 3.11+ installed
- API Key from Tongyi Qianwen (Free tier available)
# 1. Clone the repository
git clone https://github.com/cn-vhql/StoryCraft.git
cd StoryCraft
# 2. Install dependencies
pip install -r requirements.txt
# 3. Configure API keys
cp .env.example .env
# Edit .env and add your API key
# 4. Run the application
streamlit run src/app.pyThe application will open automatically in your browser at http://localhost:8501
- Download Python from python.org
- Install Python 3.11 or higher
- Important: Check "Add Python to PATH" during installation
Verify installation:
python --versionStoryCraft uses AI services to generate stories and images. You'll need API keys:
- Visit Alibaba Cloud Bailian Platform
- Register/Login to your account
- Enable "Tongyi Qianwen" service (Free tier for new users)
- Create an API Key
- Visit Volcengine Console
- Create inference endpoint to get API Key
- Add to
.envfile (see configuration below)
💡 Tip: Start with Tongyi Qianwen - simpler setup, beginner-friendly
Edit .env file in the project root:
# Tongyi Qianwen Configuration
API_KEY=sk-your-api-key-here
API_ENDPOINT=https://dashscope.aliyuncs.com/compatible-mode/v1
TEXT_MODEL=qwen-plus
IMAGE_SERVICE=tongyi
# Optional: Doubao Configuration
ARK_API_KEY=your-doubao-key-here
IMAGE_SERVICE=doubao
# Image Configuration
IMAGE_SIZE=1104x1472 # 3:4 portrait, suitable for picture books
# Application Settings
MAX_SCENES=30
MIN_SCENES=1
DEFAULT_SCENES=10streamlit run src/app.pyVisit http://localhost:8501 in your browser
Left Sidebar - Configuration:
- 📝 Story Creation: Input ideas, character name, story length
- 🎨 Image Settings: Select style and dimensions
- 🔄 Regenerate: Recreate unsatisfactory images
Main Area - Operations:
- Generate story (Chinese)
- Edit and confirm story
- Generate illustrations (auto-translate + auto-generate images)
- Preview and download PDF
Example: A little rabbit discovers a magical seed in the forest,
waters it every day, and it grows into a tree full of candies...
Examples: Little Rabbit, Little Bear, Doudou
Recommended: 3-10 scenes (each scene = one page)
AI will automatically create a Chinese story
If not satisfied, modify any page's text
| Style | Characteristics | Best For |
|---|---|---|
| Manga | Black & white lines, clean | Kindle e-readers |
| Anime | Colorful, vibrant | Color tablets |
| Chinese | Traditional ink painting | Cultural themes |
| Watercolor | Soft, artistic | Gentle stories |
| Cartoon | Cute, simple | Ages 3-5 |
| Oil Painting | Rich colors, 3D effect | Art appreciation |
| Watercolor | Light, airy | Warm stories |
| Classical | European oil painting | Fairy tales |
AI will automatically:
- Translate all scenes to English
- Generate illustrations for each page
Enter title and author name
Click "Generate and Download PDF"
Generated files are saved in output/ directory with timestamp organization:
output/
└── 20260125_143000_LittleRabbit/
├── scene_1.png # Page 1 illustration
├── scene_2.png # Page 2 illustration
├── scene_3.png # Page 3 illustration
├── story_draft.txt # Story draft (text version)
└── LittleRabbit_Story.pdf # Final PDF picture book
PDF_IMAGE_QUALITY=70 # Image compression (1-100, default 85)
PDF_MAX_IMAGE_DIMENSION=1024 # Max image size (default 1200)FONT_SIZE=20 # Font size (default 24)Tongyi Qianwen (wan2.6-t2i):
1104x1472(3:4 portrait, recommended)1280x1280(1:1 square)960x1280(3:4 portrait)1472x1104(4:3 landscape)960x1696(9:16 portrait tall)
Doubao:
1920x2560(3:4 portrait, recommended)2048x2730(3:4 portrait, HD)2048x2048(1:1 square)2560x1920(4:3 landscape)2048x1536(4:3 landscape small)
Solution:
pip install -r requirements.txtSolutions:
- Check
.envfile for correct API_KEY - Verify API key has required service enabled
- Check network connection
Solutions:
- Confirm API key has image generation permissions
- Try reducing scene count
- Switch image generation service (Tongyi ⇄ Doubao)
# View recent logs
tail -f output/app.log-
Be Specific with Story Ideas
- ✅ "Little rabbit finds magical seed, waters it daily, grows into candy tree"
- ❌ "Write a children's story"
-
Keep Character Names Simple
- ✅ "Little Rabbit", "Doudou", "Mingming"
- ❌ "Alexander Nicolaevich"
-
Moderate Scene Count
- ✅ 3-10 scenes
- ❌ 30 scenes (will take very long)
-
Preview Before Download Preview images before generating PDF
-
Use Edit Feature AI-generated stories can be freely modified to better suit your needs
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Thanks to the following open-source projects and services:
- Streamlit - Web framework
- ReportLab - PDF generation
- Tongyi Qianwen - AI service
- Doubao - AI service
- 🐛 Bug Reports: Submit Issue
- 💬 Discussions: Share your creations
Picture book content generated by this project is entirely AI-generated. Parents should review content for suitability before reading to children.
Made with ❤️ for kids | Using AI to create beautiful stories for children

