Use qwen-doc-turbo to generate AI-driven PPT slide images through direct API calls, with the wan2.7-image model scheduled behind the scenes.
Quick Start
1. Configure environment variables DASHSCOPE_API_KEY
2. Understand capabilities → Read the core capabilities introduction below
3. Prepare input → Choose either a file path or text content
4. Run the script → scripts/pptx_generator.py
Core capabilities:
- ✅ Document to PPT: Directly pass in a file, automatically parse it, and generate slides
- ✅ Text to PPT: Generate a presentation based on text content or a topic description
- ✅ Stylized generation: Supports specifying visual style and narrative style
- ✅ AI image rendering: Each slide is generated with high-quality accompanying images by the Wan2.7-Image model
🎉 Limited-time offer: Currently, Wan2.7-Image image generation is invoked through qwen-doc-turbofree for a limited time, with only text token costs calculated. Welcome to try it!
Environment variable configuration
Before use, you need to set the DashScope API Key:
Get API Key:
- Visit the Alibaba Cloud Model Studio console:https://bailian.console.aliyun.com/
- After logging in, create or obtain your API Key on the API Key management page
Before running the script, please first check whether DASHSCOPE_API_KEY has been configured in the environment
Style selection guidance
If the user has already clearly stated a style, skip this menu and generate directly.
When the user has not specified a style, or says "help me choose one," "you decide," or "what styles are there," proactively show the style menu for the user to choose from, in the following format:
🎨 Please choose your preferred PPT style:
🎌 Japanese anime / anime style
Doraemon / Hayao Miyazaki / Akira Toriyama / Dragon Ball / Naruto / One Piece / Demon Slayer Bleach / Slam Dunk / One-Punch Man / Sailor Moon / Chibi Maruko-chan / Gintama Saint Seiya / Astro Boy / Crayon Shin-chan / JoJo's Bizarre Adventure / Luo Xiaohei / 3D-rendered 2D
🦸 Western comic style
Marvel / DC / Batman / X-Men / Sin City / Hellboy / American comics
🇨🇳 Chinese style / Chinese animation
New Chinese-style guochao / ink wash style / Dunhuang style / gongbi painting / ukiyo-e / paper-cut style Sanmao Wandering Story / Old Master Q / Chu Te-yung / Blades of the Guardians / Wind and Cloud: Dominating the World
🎮 Game / pixel style
Genshin Impact / Zelda / Minecraft / cyberpunk / arcade / pixel style low-poly modeling / block style / 2.5D / 3D
✏️ Illustration / design style
MBE illustration / flat design / pop art / Memphis / Bauhaus / Apple design material design / neumorphism / claymorphism / hand-drawn / sketch / stationery journal
🖼️ Art / painting style
oil painting / watercolor / printmaking / woodcut / stained glass / hyperrealism / surrealism Van Gogh / Monet / Da Vinci / Mondrian / Cubism / Op Art
🌈 Trend / special effects style
Vaporwave / Steampunk / Cel-shading / Acid design / Glitch aesthetic / Tech future Gothic / Heavy industry / Stop-motion animation
📸 Retro / Lifestyle
Film retro / Distressed style / Nostalgic style / Nordic style / Cream style / Japanese wabi-sabi Wes Anderson / IKEA / Victorian / Art Nouveau / Big-character poster / Magazine layout
🎤 Speech / Business style
TED style
Just reply with the style name, or "pick the most suitable one from Japanese anime". If you cannot choose, I will select the most suitable style for you to make the PPT.
Workflow: PPT generation process
- Determine input type - Based on whether the user provides a file or text, choose the corresponding input method
- Call the generation script - Call
scripts/pptx_generator.py, passing in the content, query instruction, and output directory - The generation script saves results in real time:
- Outline received → save as
content.md - Image URL for each page received → download and save page by page as
1.jpg、2.jpg... - PPTX download link received → download and save as
presentation_{timestamp}.pptx
- Outline received → save as
- Display results - Show page image previews in the user interface
- Prompt to save - Inform the user that image links are valid for 24 hours, and it is recommended to specify a directory for long-term storage
Command Line Arguments
| Argument | Short form | Required | Description |
|---|---|---|---|
| --content | -c | No* | PPT text content |
| --file | -f | No* | Input file path (supports pdf, docx, txt, md, etc.) |
| --query | -q | Yes | Style and requirement description, e.g. "generate a PPT with Doraemon visual style and TED narrative style" |
| --mode | -m | No | Generation mode, defaults to creative |
| --output-dir | -o | No | Output directory; once specified, automatically saves the outline, page images, and PPTX file |
*Note:--content and --file at least one must be provided
Output Files
When --output-dir is specified, the script willin real timesave the results to the output directory:
| File | Generation timing | Description |
|---|---|---|
content.md |
When the outline is received (1st return) | PPT outline and storyboard script |
1.jpg, 2.jpg, ... N.jpg |
When each page's image URL is received (returned page by page) | Preview image of each slide rendered by Wan2.7-Image, named by page number |
presentation_{timestamp}.pptx |
When the PPTX download link is received (final return) | Complete PowerPoint file |
Usage Examples
Example 1: Pass in a file to generate a PPT
python3 scripts/pptx_generator.py \
-f ~/Downloads/document.pdf \
-q "用哆啦A梦视觉风格和TED叙事风格生成PPT" \
-m creative \
-o /path/to/output/dir
Example 2: Pass in text content to generate a PPT
python3 scripts/pptx_generator.py \
-c "产品名称:智能助手。核心功能:自然语言处理、任务自动化、多平台支持。" \
-q "用极简商务风格和TED叙事风格生成PPT,共5页" \
-m creative \
-o /path/to/output/dir
Generation task taking too long and progress tracking
Track progress in real time via the log file scripts/pptx_generator.log . Each run first clears the log, then writes timestamped log records one by one.
Important principle: If the task does not return results for a long time, inform the user of the current progress and suggest checking the output directory later. Never modify the user's requirements without permission, such as reducing the number of pages or lowering generation quality.
Error Handling
| Error | Cause | Solution |
|---|---|---|
| API key not provided | API Key not set | Set the DASHSCOPE_API_KEY environment variable |
| Request failed: code=XXX | API call failed | Check the network connection, API Key validity, and model availability |
| Failed to parse response | Abnormal response format | See scripts/pptx_generator.log for detailed information |
| content or file must be provided | No input content provided | Use the -c or -f parameter to provide content |
| BalanceError | Insufficient account balance or backend service exception | Check the Alibaba Cloud account balance and try again later |
Detailed error code reference:DashScope error code documentation
Related files
- 🐍 pptx_generator.py - PPT generation main script
- 📄 pptx_generator.log - Real-time runtime log