Thanks to visit codestin.com
Credit goes to github.com

Skip to content

AI-Powered Instagram Cleanup

rsaim/instasanity

Repository files navigation

🧹 InstaSanity - GenAI Instagram Cleanup

An intelligent, privacy-first Instagram account analyzer powered by cutting-edge Generative AI and Local LLM technology. Uses sophisticated AI reasoning to detect spam, inappropriate content, and bot accounts while maintaining complete privacy through local processing.

✨ Key Features

  • 🤖 Local AI Analysis - Ollama + LLaMA 3.2 with chain-of-thought reasoning
  • 🔒 Privacy First - 100% local processing, zero cloud dependencies
  • 🎯 Multi-Dimensional Scoring - Spam, content, bot, quality detection
  • Smart Caching - 90%+ cache hits, sub-second responses
  • 📊 Batch Processing - Analyze hundreds of accounts efficiently
  • 🔍 Transparent AI - See exactly how AI reaches each decision
  • 📥 Export Results - Download analysis as CSV

📱 App Screens

Login Interface

1751515644376

Analysis Results Dashboard

1751515431775

User Analysis Tiles

1751515463869

🚀 Quick Start

# Setup and run
git clone <your-repo-url>
cd instasanity
make setup
make run

# Access at http://localhost:8501

Requirements: Docker, 4GB+ RAM, Optional GPU

🤖 GenAI Architecture

AI-Powered Analysis Pipeline

┌─────────────────────────────────────────────────────────────┐
│                  🧠 LOCAL LLM LAYER                        │
├─────────────────┬──────────────────┬─────────────────────────┤
│   Streamlit UI  │  Analysis Core   │   🦙 Ollama Engine      │
│   • Real-time   │  • Multi-criteria│   • Chain-of-Thought    │
│   • Interactive │  • Batch Process │   • Content Moderation  │
└─────────────────┴──────────────────┴─────────────────────────┘
         │                │                        │
         ▼                ▼                        ▼
┌─────────────────┐ ┌──────────────┐ ┌─────────────────┐
│ Instagram API   │ │  Smart Cache │ │  Redis Session  │
│ (Data Source)   │ │  (24h TTL)   │ │  (State Mgmt)   │
└─────────────────┘ ┌──────────────┘ └─────────────────┘

Advanced AI Features

🧠 Chain-of-Thought Analysis

# Multi-step reasoning for transparent decisions
analysis_prompt = """
Think step by step:
1. SPAM: promotional language, follow-for-follow patterns
2. CONTENT: inappropriate material, violence, hate speech  
3. BOTS: username patterns, behavioral signals
4. QUALITY: authenticity, completeness

Return JSON with reasoning, scores, confidence...
"""

⚡ Performance Optimization

  • Smart Caching: MD5 cache keys, 24h TTL, 90%+ hit rates
  • Batch Processing: 200+ accounts in <2 minutes with caching
  • Fallback Intelligence: Rule-based backup when LLM unavailable
  • Real-time Metrics: Cache efficiency, confidence scoring

🔒 Privacy & Security

  • Local Processing: No external API calls, Ollama runs locally
  • Data Isolation: All analysis happens on your machine
  • Session Management: Secure Instagram API integration
  • Zero Telemetry: No usage data sent anywhere

🛠️ Technology Stack

Component Technology Purpose
AI/ML Ollama + LLaMA 3.2 Local LLM analysis engine
Frontend Streamlit Interactive web interface
Backend Python 3.11+ Core logic & Instagram API
Caching DiskCache + Redis Performance optimization
Deployment Docker Compose Service orchestration

📊 Analysis Scoring

  • 0-3: Keep following (good accounts)
  • 4-6: Review manually (questionable accounts)
  • 7-10: Consider unfollowing (problematic accounts)

Analysis includes: Overall score, detailed reasoning, confidence level, content flags, account metadata

🔧 Commands

make setup    # Install AI models
make run      # Start application  
make stop     # Stop services
make logs     # View logs
make clean    # Clean containers

🐳 Services

  1. InstaSanity (8501) - Main application
  2. Ollama (11434) - AI model server
  3. Redis (6379) - Caching layer

🛠️ Development

make dev-build && make dev-run  # Development mode
make logs-app                   # Application logs
make logs-ollama               # AI model logs

📝 Configuration

Key settings in config.py:

  • Ollama model and host configuration
  • Cache TTL and directory settings
  • Instagram API rate limits

🤝 Contributing

  1. Fork repository
  2. Create feature branch
  3. Test with make dev-run
  4. Submit pull request

📄 License & Disclaimer

MIT License. For educational/personal use only. Always review AI results manually before taking action. Respect Instagram's Terms of Service.

About

AI-Powered Instagram Cleanup

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published