Update README.md
Browse files
README.md
CHANGED
@@ -1,12 +1,206 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Marketing Image Generator with Agent Review
|
2 |
+
|
3 |
+
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.
|
4 |
+
|
5 |
+
## Features
|
6 |
+
|
7 |
+
- **AI-Powered Image Generation**: Create stunning marketing images from text prompts using Google's Imagen3
|
8 |
+
- **Automated Quality Review**: Intelligent agents automatically review and refine generated images
|
9 |
+
- **Marketing-Focused**: Optimized for marketing materials, social media, and promotional content
|
10 |
+
- **Real-time Feedback**: Get instant quality scores and improvement suggestions
|
11 |
+
- **Professional Workflow**: Streamlined process from concept to final image
|
12 |
+
- **Download & Share**: Easy export of generated images in multiple formats
|
13 |
+
|
14 |
+
## Quick Start
|
15 |
+
|
16 |
+
1. **Clone the repository**
|
17 |
+
```bash
|
18 |
+
git clone <repository-url>
|
19 |
+
cd MarketingImageGenerator
|
20 |
+
```
|
21 |
+
|
22 |
+
2. **Install dependencies**
|
23 |
+
```bash
|
24 |
+
pip install -r requirements.txt
|
25 |
+
```
|
26 |
+
|
27 |
+
3. **Set up Google Cloud authentication**
|
28 |
+
```bash
|
29 |
+
export GOOGLE_SERVICE_ACCOUNT_JSON='{"type":"service_account",...}'
|
30 |
+
# Or set GOOGLE_API_KEY for Google AI Studio
|
31 |
+
```
|
32 |
+
|
33 |
+
4. **Run the Gradio app**
|
34 |
+
```bash
|
35 |
+
python app.py
|
36 |
+
```
|
37 |
+
|
38 |
+
5. **Access the web interface**
|
39 |
+
```
|
40 |
+
http://localhost:7860
|
41 |
+
```
|
42 |
+
|
43 |
+
## System Architecture
|
44 |
+
|
45 |
+
### Core Components
|
46 |
+
|
47 |
+
- **Image Generator Agent**: Creates images using Google's Imagen3
|
48 |
+
- **Review Agent**: Analyzes image quality and provides feedback
|
49 |
+
- **Orchestrator**: Manages workflow between agents
|
50 |
+
- **Web Interface**: Gradio-based user interface optimized for Hugging Face
|
51 |
+
- **Agent Integration**: Direct A2A protocol communication between agents
|
52 |
+
|
53 |
+
### Technology Stack
|
54 |
+
|
55 |
+
- **AI Models**: Google Imagen3, Gemini Vision
|
56 |
+
- **Framework**: Gradio (Web Interface)
|
57 |
+
- **Orchestration**: Integrated A2A agent protocol
|
58 |
+
- **Deployment**: Hugging Face Spaces
|
59 |
+
- **Authentication**: Google Cloud Service Account
|
60 |
+
|
61 |
+
## Usage
|
62 |
+
|
63 |
+
### Web Interface (Gradio)
|
64 |
+
|
65 |
+
1. Access the app on Hugging Face Spaces
|
66 |
+
2. Enter your marketing image description in the prompt field
|
67 |
+
3. Select your preferred art style (realistic, artistic, etc.)
|
68 |
+
4. Configure quality threshold and advanced settings
|
69 |
+
5. Click "Generate & Review Marketing Image"
|
70 |
+
6. View the generated image with AI quality analysis and download
|
71 |
+
|
72 |
+
### API Usage
|
73 |
+
|
74 |
+
```python
|
75 |
+
import requests
|
76 |
+
|
77 |
+
# Generate an image
|
78 |
+
response = requests.post("http://localhost:8000/generate", json={
|
79 |
+
"prompt": "A modern office space with natural lighting",
|
80 |
+
"style": "realistic",
|
81 |
+
"enable_review": True
|
82 |
+
})
|
83 |
+
|
84 |
+
# Get the generated image and review results
|
85 |
+
result = response.json()
|
86 |
+
image_data = result["data"]["image"]["data"]
|
87 |
+
quality_score = result["data"]["review"]["quality_score"]
|
88 |
+
```
|
89 |
+
|
90 |
+
## Configuration
|
91 |
+
|
92 |
+
### Environment Variables
|
93 |
+
|
94 |
+
- `GOOGLE_API_KEY`: Your Google AI API key
|
95 |
+
- `IMAGEN3_API_KEY`: Imagen3 API key (if different)
|
96 |
+
- `LOG_LEVEL`: Logging level (DEBUG, INFO, WARNING, ERROR)
|
97 |
+
- `PORT`: Web server port (default: 8000)
|
98 |
+
- `STREAMLIT_PORT`: Streamlit port (default: 8501)
|
99 |
+
|
100 |
+
### Advanced Settings
|
101 |
+
|
102 |
+
- **Quality Threshold**: Minimum quality score for auto-approval
|
103 |
+
- **Max Iterations**: Maximum refinement attempts
|
104 |
+
- **Review Settings**: Customize review criteria
|
105 |
+
|
106 |
+
## Development
|
107 |
+
|
108 |
+
### Project Structure
|
109 |
+
|
110 |
+
```
|
111 |
+
MarketingImageGenerator/
|
112 |
+
βββ agents/ # AI agents
|
113 |
+
β βββ generator/ # Image generation agent
|
114 |
+
β βββ reviewer/ # Quality review agent
|
115 |
+
β βββ orchestrator/ # Workflow orchestration
|
116 |
+
βββ api/ # FastAPI endpoints
|
117 |
+
βββ web/ # Streamlit interface
|
118 |
+
βββ tools/ # Utility tools
|
119 |
+
βββ tests/ # Test suite
|
120 |
+
βββ docs/ # Documentation
|
121 |
+
βββ deployment/ # Docker & K8s configs
|
122 |
+
```
|
123 |
+
|
124 |
+
### Running Tests
|
125 |
+
|
126 |
+
```bash
|
127 |
+
# Run all tests
|
128 |
+
pytest
|
129 |
+
|
130 |
+
# Run specific test suite
|
131 |
+
pytest tests/test_generation.py
|
132 |
+
pytest tests/test_review.py
|
133 |
+
```
|
134 |
+
|
135 |
+
### Contributing
|
136 |
+
|
137 |
+
1. Fork the repository
|
138 |
+
2. Create a feature branch
|
139 |
+
3. Make your changes
|
140 |
+
4. Add tests for new functionality
|
141 |
+
5. Submit a pull request
|
142 |
+
|
143 |
+
## Deployment
|
144 |
+
|
145 |
+
### Docker
|
146 |
+
|
147 |
+
```bash
|
148 |
+
# Build the image
|
149 |
+
docker build -t marketing-image-generator .
|
150 |
+
|
151 |
+
# Run the container
|
152 |
+
docker run -p 8000:8000 -p 8501:8501 marketing-image-generator
|
153 |
+
```
|
154 |
+
|
155 |
+
### Kubernetes
|
156 |
+
|
157 |
+
```bash
|
158 |
+
# Deploy to Kubernetes
|
159 |
+
kubectl apply -f k8s/
|
160 |
+
|
161 |
+
# Check deployment status
|
162 |
+
kubectl get pods -n marketing-image-generator
|
163 |
+
```
|
164 |
+
|
165 |
+
## Monitoring
|
166 |
+
|
167 |
+
The system includes comprehensive monitoring:
|
168 |
+
|
169 |
+
- **Health Checks**: Automatic service health monitoring
|
170 |
+
- **Metrics**: Performance and usage metrics
|
171 |
+
- **Logging**: Structured logging for debugging
|
172 |
+
- **Alerts**: Automated alerting for issues
|
173 |
+
|
174 |
+
Access monitoring dashboards:
|
175 |
+
- Prometheus: `http://localhost:9090`
|
176 |
+
- Grafana: `http://localhost:3000`
|
177 |
+
|
178 |
+
## Troubleshooting
|
179 |
+
|
180 |
+
### Common Issues
|
181 |
+
|
182 |
+
1. **API Key Errors**: Ensure your Google API key is valid and has the necessary permissions
|
183 |
+
2. **Image Generation Fails**: Check your internet connection and API quotas
|
184 |
+
3. **Review Not Working**: Verify the review agent is running and configured correctly
|
185 |
+
|
186 |
+
### Debug Mode
|
187 |
+
|
188 |
+
Enable debug logging by setting `LOG_LEVEL=DEBUG` in your environment variables.
|
189 |
+
|
190 |
+
### Support
|
191 |
+
|
192 |
+
For issues and questions:
|
193 |
+
- Check the documentation in `/docs`
|
194 |
+
- Review the troubleshooting guide
|
195 |
+
- Open an issue on GitHub
|
196 |
+
|
197 |
+
## License
|
198 |
+
|
199 |
+
This project is licensed under the MIT License - see the LICENSE file for details.
|
200 |
+
|
201 |
+
## Acknowledgments
|
202 |
+
|
203 |
+
- Google AI for Imagen3 and Gemini technologies
|
204 |
+
- Streamlit for the web interface framework
|
205 |
+
- FastAPI for the API framework
|
206 |
+
- The open-source community for various dependencies
|