A delightful voice-to-image generation application built with TEN Framework. Kids speak what they want to draw, and AI creates it instantly!
- Voice Activity Detection: Automatic speech detection - no buttons needed!
- Natural Speech Input: Kids just talk naturally about what they want to create
- GPT Image 1.5: Latest, fastest OpenAI image generation (4x faster than DALL-E 3)
- Kid-Friendly UI: Colorful, engaging interface via dedicated doodler frontend
- Instant Results: Images appear in seconds
- Safe & Encouraging: Gentle error messages and positive feedback
- Kid speaks: "I want a purple dragon flying over a rainbow castle!"
- AI listens: OpenAI Whisper transcribes speech
- AI understands: GPT-4o-mini processes the request
- AI creates: GPT Image 1.5 generates the image
- Kid sees: Image appears in the chat!
-
Agora Account (for voice input)
- Sign up at console.agora.io
- Get your
AGORA_APP_ID
-
OpenAI Account (for everything else)
- Sign up at platform.openai.com
- Get your
OPENAI_API_KEY - You'll need access to:
- Whisper (speech-to-text)
- GPT-4o-mini (language model)
- GPT Image 1.5 (image generation)
- Node.js: >= 20
- Bun: Latest version
- Go: For API server
- Python: 3.10+ (for TEN extensions)
- TEN Framework: Installed via
tman
cd ai_agents/agents/examples/doodlerCreate a .env file in the root ai_agents directory:
# Required
AGORA_APP_ID=your_agora_app_id
OPENAI_API_KEY=sk-your_openai_key
# Optional
AGORA_APP_CERTIFICATE=your_certificate
OPENAI_MODEL=gpt-4o-mini
AGENT_SERVER_URL=http://localhost:8080
TEN_DEV_SERVER_URL=http://localhost:49483
NEXT_PUBLIC_EDIT_GRAPH_MODE=truetask installThis will:
- Install TEN framework packages
- Install Python dependencies
- Install frontend
- Build the API server
task runThis starts:
- TEN Runtime (agent backend)
- API Server (port 8080)
- TMAN Designer (port 49483)
- Frontend will be available from the doodler frontend
Frontend source lives in ai_agents/agents/examples/doodler/frontend.
- Frontend: http://localhost:3000
- API Server: http://localhost:8080
- TMAN Designer: http://localhost:49483
GET /graphslists available graphs intenapp/property.jsonfor the API server:curl http://localhost:8080/graphsPOST /startlaunches a worker with the selected graph and optional property overrides:curl -X POST http://localhost:8080/start \ -H 'Content-Type: application/json' \ -d '{ "request_id":"any-id", "channel_name":"kids_demo", "user_uid":10001, "graph_name":"voice_image_kids", "properties":{} }'
- Open http://localhost:3000 in your browser
- Allow microphone access when prompted
- Start speaking! For example:
- "I want a spaceship in outer space!"
- "Draw a cute puppy playing in a park"
- "Create a magical fairy castle with rainbows"
- Watch as the AI creates your image!
The app uses these components:
- agora_rtc: Audio I/O with voice activity detection
- openai_asr_python: Speech-to-text (Whisper)
- openai_llm2_python: Language model (GPT-4o-mini)
- openai_gpt_image_python: Image generation (GPT Image 1.5)
- main_python: Orchestration
- message_collector: Chat history
Edit tenapp/property.json to customize:
LLM Prompt (make it more/less kid-friendly):
{
"nodes": [{
"name": "llm",
"property": {
"prompt": "Your custom system prompt here..."
}
}]
}Image Settings:
{
"nodes": [{
"name": "image_gen_tool",
"property": {
"params": {
"model": "gpt-image-1.5", // or "dall-e-3"
"size": "1024x1024", // or "1792x1024", "1024x1792"
"quality": "standard" // or "hd" for higher quality
}
}
}]
}doodler/
├── tenapp/
│ ├── property.json # Agent graph configuration
│ ├── manifest.json # App metadata
│ └── ten_packages/
│ └── extension/
│ └── main_python/ # Main control logic
│ ├── extension.py # Event handlers
│ ├── config.py # Configuration
│ └── agent/ # Agent framework
├── Taskfile.yml # Build & run automation
├── Dockerfile # Container deployment
├── .env.example # Environment template
└── README.md # This file
- Check microphone permissions in browser
- Verify
AGORA_APP_IDis set correctly - Check browser console for errors
- Verify
OPENAI_API_KEYhas access to GPT Image 1.5 - Check TEN runtime logs:
tail -f tenapp/logs/latest.log - Try fallback model (DALL-E 3) in configuration
- Double-check
OPENAI_API_KEYin.env - Ensure no extra spaces or quotes
- Verify key is active on OpenAI platform
# Clean install
cd tenapp
rm -rf ten_packages
tman install
./scripts/install_python_deps.shcd ai_agents
docker build -f agents/examples/doodler/Dockerfile -t doodler .docker run --rm -it --env-file .env \
-p 8080:8080 \
-p 3000:3000 \
-p 49483:49483 \
doodler- Frontend: http://localhost:3000
- API: http://localhost:8080
- TMAN Designer: http://localhost:49483
Access TMAN Designer at http://localhost:49483 to:
- Visualize the agent graph
- Modify connections visually
- Test different configurations
- Add new extensions
- Add a new extension to
tenapp/property.json - Configure connections in the graph
- Update main_python to handle new events
- Test with
task run
Enable debug mode in tenapp/property.json:
{
"nodes": [{
"name": "image_gen_tool",
"property": {
"dump": true,
"dump_path": "./debug_images.json"
}
}]
}View logs:
# TEN runtime logs
tail -f tenapp/logs/latest.log
# API server logs
# (shown in terminal where you ran `task run`)The app uses OpenAI's content policy filtering. If an image request violates policies, kids will see:
"I can't create that image. Let's try something different!"
The LLM is configured to be encouraging and kid-friendly.
- Voice-to-Text: ~500ms (Whisper)
- LLM Processing: ~1-2s (GPT-4o-mini)
- Image Generation: ~3-5s (GPT Image 1.5) - 4x faster than DALL-E 3!
- Total: ~5-8 seconds from speech to image
Per image generation:
- Whisper transcription: ~$0.006/minute
- GPT-4o-mini: ~$0.001 (for prompt processing)
- GPT Image 1.5 (1024x1024, standard): ~$0.04
- Total per image: ~$0.05
(Prices as of December 2024, may vary)
- TEN Framework Documentation
- OpenAI Image Generation Guide
- GPT Image 1.5 Announcement
- Agora RTC Documentation
This example is part of the TEN Framework, licensed under the Apache License, Version 2.0.
- TEN Framework Issues: github.com/TEN-framework/TEN-Agent
- OpenAI Support: help.openai.com
- Agora Support: agora.io/support
Have fun creating amazing art with AI! 🎨✨