Noo88ear's picture
Update README.md
8689f6e verified
|
raw
history blame
5.68 kB

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

  1. Clone the repository

    git clone <repository-url>
    cd MarketingImageGenerator
    
  2. Install dependencies

    pip install -r requirements.txt
    
  3. Set up Google Cloud authentication

    export GOOGLE_SERVICE_ACCOUNT_JSON='{"type":"service_account",...}'
    # Or set GOOGLE_API_KEY for Google AI Studio
    
  4. Run the Gradio app

    python app.py
    
  5. 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)

  1. Access the app on Hugging Face Spaces
  2. Enter your marketing image description in the prompt field
  3. Select your preferred art style (realistic, artistic, etc.)
  4. Configure quality threshold and advanced settings
  5. Click "Generate & Review Marketing Image"
  6. 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 key
  • IMAGEN3_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

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests for new functionality
  5. 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

  1. API Key Errors: Ensure your Google API key is valid and has the necessary permissions
  2. Image Generation Fails: Check your internet connection and API quotas
  3. 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