Marketing Image Generator with Agent Review
A sophisticated AI-powered image generation system that creates high-quality marketing images with automated quality review and refinement. Built on modern AI technologies including Google's Imagen3 and advanced agent orchestration.
Features
- AI-Powered Image Generation: Create stunning marketing images from text prompts using Google's Imagen3
- Automated Quality Review: Intelligent agents automatically review and refine generated images
- Marketing-Focused: Optimized for marketing materials, social media, and promotional content
- Real-time Feedback: Get instant quality scores and improvement suggestions
- Professional Workflow: Streamlined process from concept to final image
- Download & Share: Easy export of generated images in multiple formats
Quick Start
Clone the repository
git clone <repository-url> cd MarketingImageGenerator
Install dependencies
pip install -r requirements.txt
Set up Google Cloud authentication
export GOOGLE_SERVICE_ACCOUNT_JSON='{"type":"service_account",...}' # Or set GOOGLE_API_KEY for Google AI Studio
Run the Gradio app
python app.py
Access the web interface
http://localhost:7860
System Architecture
Core Components
- Image Generator Agent: Creates images using Google's Imagen3
- Review Agent: Analyzes image quality and provides feedback
- Orchestrator: Manages workflow between agents
- Web Interface: Gradio-based user interface optimized for Hugging Face
- Agent Integration: Direct A2A protocol communication between agents
Technology Stack
- AI Models: Google Imagen3, Gemini Vision
- Framework: Gradio (Web Interface)
- Orchestration: Integrated A2A agent protocol
- Deployment: Hugging Face Spaces
- Authentication: Google Cloud Service Account
Usage
Web Interface (Gradio)
- Access the app on Hugging Face Spaces
- Enter your marketing image description in the prompt field
- Select your preferred art style (realistic, artistic, etc.)
- Configure quality threshold and advanced settings
- Click "Generate & Review Marketing Image"
- View the generated image with AI quality analysis and download
API Usage
import requests
# Generate an image
response = requests.post("http://localhost:8000/generate", json={
"prompt": "A modern office space with natural lighting",
"style": "realistic",
"enable_review": True
})
# Get the generated image and review results
result = response.json()
image_data = result["data"]["image"]["data"]
quality_score = result["data"]["review"]["quality_score"]
Configuration
Environment Variables
GOOGLE_API_KEY
: Your Google AI API keyIMAGEN3_API_KEY
: Imagen3 API key (if different)LOG_LEVEL
: Logging level (DEBUG, INFO, WARNING, ERROR)PORT
: Web server port (default: 8000)STREAMLIT_PORT
: Streamlit port (default: 8501)
Advanced Settings
- Quality Threshold: Minimum quality score for auto-approval
- Max Iterations: Maximum refinement attempts
- Review Settings: Customize review criteria
Development
Project Structure
MarketingImageGenerator/
βββ agents/ # AI agents
β βββ generator/ # Image generation agent
β βββ reviewer/ # Quality review agent
β βββ orchestrator/ # Workflow orchestration
βββ api/ # FastAPI endpoints
βββ web/ # Streamlit interface
βββ tools/ # Utility tools
βββ tests/ # Test suite
βββ docs/ # Documentation
βββ deployment/ # Docker & K8s configs
Running Tests
# Run all tests
pytest
# Run specific test suite
pytest tests/test_generation.py
pytest tests/test_review.py
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Submit a pull request
Deployment
Docker
# Build the image
docker build -t marketing-image-generator .
# Run the container
docker run -p 8000:8000 -p 8501:8501 marketing-image-generator
Kubernetes
# Deploy to Kubernetes
kubectl apply -f k8s/
# Check deployment status
kubectl get pods -n marketing-image-generator
Monitoring
The system includes comprehensive monitoring:
- Health Checks: Automatic service health monitoring
- Metrics: Performance and usage metrics
- Logging: Structured logging for debugging
- Alerts: Automated alerting for issues
Access monitoring dashboards:
- Prometheus:
http://localhost:9090
- Grafana:
http://localhost:3000
Troubleshooting
Common Issues
- API Key Errors: Ensure your Google API key is valid and has the necessary permissions
- Image Generation Fails: Check your internet connection and API quotas
- Review Not Working: Verify the review agent is running and configured correctly
Debug Mode
Enable debug logging by setting LOG_LEVEL=DEBUG
in your environment variables.
Support
For issues and questions:
- Check the documentation in
/docs
- Review the troubleshooting guide
- Open an issue on GitHub
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Google AI for Imagen3 and Gemini technologies
- Streamlit for the web interface framework
- FastAPI for the API framework
- The open-source community for various dependencies