Agentic Image Personality is an AI-powered FastAPI application that analyzes uploaded images and generates personalized, culturally-aware responses. The project leverages Google Gemini AI models for vision analysis and creates engaging interactions based on dynamic AI personality profiles.
- 🔍 Advanced Image Analysis: Uses Google Gemini vision models to describe and interpret uploaded images with cultural awareness
- 🎨 Dynamic AI Personalities: Multiple customizable AI agents with unique voices and cultural perspectives
- 🌍 Cultural Intelligence: AI recognizes and comments on cultural elements, adapting tone and language accordingly
- 📡 Production-Ready API: FastAPI backend with comprehensive endpoints and automatic documentation
- 📓 Interactive Development: Jupyter Notebook for experimentation and testing
- ☁️ Cloud Deployment: Automated Google Cloud Run deployment via GitHub Actions
- 🔒 Secure Configuration: Environment-based API key management
- Upload an image (e.g., selfie or portrait)
- AI analyzes the image using Google Gemini vision models
- Cultural context recognition identifies elements and background
- Personalized response generation creates engaging, witty responses
- Culturally-aware delivery adapts tone and language appropriately
- Python 3.9+
- Google Generative AI API key (Gemini)
- (Optional) Jupyter Notebook for interactive use
git clone https://github.com/yourusername/Agentic-ImagePersonality-3.git
cd Agentic-ImagePersonality-3
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txtCreate a .env file:
GOOGLE_API_KEY=your_gemini_api_key_herepython main.pyVisit http://localhost:8000/docs for the interactive API documentation.
| Method | Endpoint | Description |
|---|---|---|
GET |
/ |
API information and available personalities |
GET |
/bots |
List all available AI agents |
POST |
/analyze_image_with_file |
Upload image file for analysis |
POST |
/analyze_image_with_base64 |
Send base64 image for analysis |
GET |
/health |
Health check and system status |
curl -X POST "http://localhost:8000/analyze_image_with_file" \
-H "Content-Type: multipart/form-data" \
-F "image=@your_image.jpg" \
-F "bot_id=mentor_male"curl -X POST "http://localhost:8000/analyze_image_with_base64" \
-H "Content-Type: application/json" \
-d '{
"image_base64": "iVBORw0KGgoAAAANSUhEUgAA...",
"bot_id": "cultural_advisor"
}'Agentic-ImagePersonality-3/
├── main.py # FastAPI application
├── bot_persona.py # AI personality configurations
├── agenticImagePersonality1.ipynb # Jupyter notebook for testing
├── requirements.txt # Python dependencies
├── .env # Environment variables (create this)
├── .gitignore # Git ignore rules
├── .github/
│ └── workflows/
│ └── deploy.yml # GitHub Actions deployment
└── README.md # This file
Use the Jupyter notebook for experimentation:
jupyter notebook agenticImagePersonality1.ipynb- Edit
bot_persona.py - Add your personality configuration
- Test with the API endpoints
# Start the server
python main.py
# Test health endpoint
curl http://localhost:8000/health
# Get available personalities
curl http://localhost:8000/botsThe project includes GitHub Actions for automatic deployment:
-
Set up secrets in your GitHub repository:
GCP_CREDENTIALS: Your Google Cloud service account JSONGOOGLE_API_KEY: Your Gemini API key
-
Push to main branch:
git push origin main
-
Monitor deployment: Check the Actions tab in your GitHub repository
# Deploy to Cloud Run
gcloud run deploy fastapi-image-personality \
--source . \
--region us-central1 \
--set-env-vars GOOGLE_API_KEY=$GOOGLE_API_KEY- FastAPI - Modern web framework for APIs
- Google Generative AI - Gemini vision and text models
- Pillow - Image processing
- Uvicorn - ASGI server
- Pydantic - Data validation
See requirements.txt for complete list.
- API keys are managed through environment variables
- Images are temporarily processed and can be stored as base64
- No persistent storage of user images by default
- CORS middleware configured for frontend integration
- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Make your changes and add tests
- Commit your changes:
git commit -m 'Add feature' - Push to the branch:
git push origin feature-name - Submit a pull request
- Issues: Report bugs or request features via GitHub Issues
- Documentation: Visit
/docsendpoint when running locally - API Reference: Interactive docs at
/docsand/redoc