autogram
autogram copied to clipboard
AI agent that automates AI news curation and post to Instagram using gpt-image-1
🤖 AutoGram
AutoGram is an intelligent AI agent that automates AI news curation and Instagram content management. It seamlessly collects tech news, generates engaging visuals, and maintains your social media presence - all on autopilot.
Demo
🔄 Collect → 🧠 Analyze → 🎨 Create → 📱 Share
✨ Key Features
- Smart News Aggregation: Automatically collects and filters AI & tech news
- AI-Powered Content Creation: Generates unique, branded images for each post
- Automated Instagram Management: Handles posting and scheduling
- Performance Analytics: Tracks engagement and optimizes content strategy
- Self-Learning: Improves content selection based on performance
- Brand Consistency: Maintains your visual identity across all posts
- Multi-Model Image Generation: Supports both OpenAI GPT Image and Replicate models
🛠️ Tech Stack
- Core Engine: Python 3.9+
- AI Services:
- Google Gemini (content analysis)
- OpenAI GPT Image (primary image generation)
- Replicate ideogram (alternative image generation)
- News Sources: GNews API
- Social Platform: Instagram API
- Processing: aiohttp, asyncio
- Validation: Pydantic
- Image Handling: Pillow
🚀 Quick Start
- Clone & Install
git clone https://github.com/ranahaani/autogram.git
cd autogram
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt
- Configure Environment
# Create .env file
cp .env.example .env
# Add your API keys
GEMINI_API_KEY=your_key_here
OPENAI_API_KEY=your_openai_key_here
REPLICATE_API_TOKEN=your_token_here
IG_USERNAME=your_username
IG_PASSWORD=your_password
- Configure Agent
// config.json
{
"name": "AutoGram",
"post_frequency": 3,
"max_news_age": 24,
"output_dir": "./output",
"brand_theme": {
"primary_color": "#FF6B6B",
"secondary_color": "#4ECDC4",
"font_style": "modern"
},
"image_generation": {
"default_provider": "openai",
"providers": {
"openai": {
"model": "gpt-image-1",
"size": "1024x1024",
"quality": "medium"
},
"replicate": {
"model": "ideogram-ai/ideogram-v2"
}
}
}
}
- Launch
python main.py
📊 Monitoring Dashboard
📈 Performance Metrics
- Posts Created: 125
- Engagement Rate: 3.2%
- Top Performing Topics: AI, Machine Learning, Tech Innovation
- Average Likes: 234
- Comment Rate: 2.1%
⚙️ Advanced Configuration
Image Generation Settings
You can configure which AI model to use for image generation in config.json:
- OpenAI GPT Image (Default)
{
"image_generation": {
"default_provider": "openai",
"providers": {
"openai": {
"model": "gpt-image-1",
"size": "1024x1024",
"quality": "medium"
}
}
}
}
- Replicate Ideogram
{
"image_generation": {
"default_provider": "replicate",
"providers": {
"replicate": {
"model": "ideogram-ai/ideogram-v2"
}
}
}
}
Custom News Sources
class NewsSource:
async def fetch(self) -> List[NewsItem]:
# Your custom news source logic
pass
Content Templates
TEMPLATES = {
"tech_news": "Modern minimalist tech visualization: {title}",
"ai_update": "Futuristic AI concept representing: {content}",
"innovation": "Creative tech breakthrough visual for: {topic}"
}
🔄 Workflow
graph LR
A[News Collection] --> B[AI Analysis]
B --> C[Content Generation]
C --> D[Image Creation]
D --> E[Instagram Posting]
E --> F[Performance Analysis]
F --> A
🚧 Error Handling
AutoGram includes robust error handling:
- Automatic retry mechanisms
- Graceful degradation
- State persistence
- Error notifications
- Performance monitoring
📱 Sample Output
📸 Generated Post Example:
- Title: "Breaking: New AI Model Achieves Human-Level Performance"
- Image: Modern tech visualization (via OpenAI GPT Image)
- Hashtags: #AI #TechNews #Innovation #FutureOfTech
- Engagement: 543 likes, 27 comments
🛡️ Best Practices
-
Content Strategy
- Post during peak engagement hours
- Maintain consistent branding
- Use trending hashtags
- Monitor performance metrics
-
System Management
- Regular log monitoring
- Backup configuration files
- Update API keys periodically
- Monitor resource usage
🔮 Roadmap
- [x] Multi-model image generation support
- [ ] AI-powered hashtag optimization
- [ ] Advanced analytics dashboard
- [ ] Custom template builder
- [ ] Engagement automation
- [ ] A/B testing system
🤝 Contributing
Contributions are welcome! Please read our Contributing Guidelines for details on our code of conduct and the process for submitting pull requests.
📜 License
AutoGram is licensed under the MIT License - see the LICENSE file for details.
Built with ❤️ by the [email protected]
Copyright © 2025 AutoGram