CoolFace
Apppublic

prafulmemane/ContentGenie

sourceHugging Facemitupdated 7mo agoView on Hugging Face
0likes
App README

✨ ContentGenie

AI-Powered Multi-Agent Content Generation Platform powered by LangGraph, OpenAI, Google Gemini, and Anthropic Claude.

Generate high-quality blog posts, LinkedIn content, images, and video scripts using an intelligent multi-agent workflow.

πŸš€ Live Demo

[Open ContentGenie on Hugging Face Spaces](https://huggingface.co/spaces/YOUR_USERNAME/ContentGenie)

(Replace YOUR_USERNAME with your actual Hugging Face username after deployment)


🎯 Features

  • β€”πŸ€– Multi-Agent Workflow
  • β€”Research Agent: Gathers information from web sources
  • β€”Content Strategist: Plans your content
  • β€”Blog Writer: Generates blog posts
  • β€”LinkedIn Writer: Creates social media content
  • β€”Image Generator: Creates visual content
  • β€”Video Script: Generates video scripts
  • β€”πŸ“Š Multiple Response Formats
  • β€”JSON: Structured data format
  • β€”XML: Markup format
  • β€”TOON: ASCII art representation
  • β€”πŸ”„ Automatic LLM Failover
  • β€”Primary: OpenAI GPT-4o
  • β€”Fallback: Google Gemini 2.0 Flash
  • β€”Alternative: Anthropic Claude 3 Sonnet
  • β€”Local: Ollama support
  • β€”πŸ›‘οΈ Content Guardrails
  • β€”Profanity filtering
  • β€”Safety validation
  • β€”Intent detection
  • β€”Rule-based filtering
  • β€”πŸ“± Professional UI
  • β€”Streamlit-powered interface
  • β€”Responsive design
  • β€”Real-time content generation
  • β€”Format-agnostic output

πŸ”§ Setup & Configuration

🌐 Hugging Face Spaces (Live)

The app requires these secrets in your HF Space Settings:

OPENAI_API_KEY        # https://platform.openai.com/api-keys
GEMINI_API_KEY        # https://aistudio.google.com/app/apikey
HF_TOKEN              # https://huggingface.co/settings/tokens
SERPAPI_API_KEY       # https://serpapi.com/dashboard

Optional secrets for additional features:

STABILITY_KEY         # https://platform.stability.ai/account/keys
RUNWAY_API_KEY        # https://runwayml.com/settings
ELEVENLABS_API_KEY    # https://elevenlabs.io/app/settings/api-keys

πŸ’» Local Development

bash
# 1. Clone the repository
git clone https://github.com/YOUR_USERNAME/ContentGenie.git
cd ContentGenie

# 2. Create virtual environment
python3 -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# 3. Install dependencies
pip install -r requirements.txt

# 4. Set up environment variables
cp .env.example .env
# Edit .env and add your API keys

# 5. Run the app
streamlit run app.py

The app will open at http://localhost:8501


πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     User Interface (Streamlit)              β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                               β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚   Input Panel    β”‚         β”‚   Output Display         β”‚  β”‚
β”‚  β”‚ β€’ Query text     │────────▢│ β€’ Format selector (JSON/ β”‚  β”‚
β”‚  β”‚ β€’ Format select  β”‚         β”‚   XML/TOON)             β”‚  β”‚
β”‚  β”‚ β€’ Submit button  β”‚         β”‚ β€’ Content output         β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β”‚ β€’ Copy/Export buttons    β”‚  β”‚
β”‚                               β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                   β”‚
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β”‚   Query Handler     β”‚
        β”‚   (Route & Orchestrate)
        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                   β”‚
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚              β”‚              β”‚
β”Œβ”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Guardrail  β”‚  β”‚ Research  β”‚  β”‚ Content    β”‚
β”‚ Engine     β”‚  β”‚ Agent     β”‚  β”‚ Generator  β”‚
β”‚            β”‚  β”‚           β”‚  β”‚            β”‚
β”‚ β€’ Profanityβ”‚  β”‚ β€’ WebSearch   β”‚ β€’ LLM     β”‚
β”‚   Filter   β”‚  β”‚ β€’ SerpAPI     β”‚   Chain   β”‚
β”‚ β€’ Safety   β”‚  β”‚ β€’ DuckDuckGo  β”‚            β”‚
β”‚ β€’ Intent   β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
     β”‚
β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚         LLM Provider Registry & Fallover              β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”           β”‚
β”‚  β”‚OpenAI    β”‚β–Ά β”‚Gemini    β”‚β–Ά β”‚Claude    β”‚           β”‚
β”‚  β”‚GPT-4o    β”‚  β”‚2.0-Flash β”‚  β”‚3-Sonnet  β”‚           β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜           β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
     β”‚
β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚           Format Converter                            β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”           β”‚
β”‚  β”‚  JSON    β”‚  β”‚  XML     β”‚  β”‚  TOON    β”‚           β”‚
β”‚  β”‚ Encoder  β”‚  β”‚ Converterβ”‚  β”‚Formatter β”‚           β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜           β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“¦ Tech Stack

ComponentTechnology
FrontendStreamlit 1.52.2
OrchestrationLangGraph 1.0.6
LLM FrameworkLangChain Core 1.2.7
LLM ProvidersOpenAI, Google, Anthropic
SearchSerpAPI, DuckDuckGo
ConfigPyYAML, Python-dotenv
DataPandas, Pydantic
DeploymentDocker, HF Spaces

πŸ“š Documentation

  • β€”[Response Formats Guide](docs/response_formats_guide.md) - Detailed format specifications
  • β€”[API Response Formats](docs/api_response_formats.md) - API response structure
  • β€”[Architecture Diagrams](docs/architecture_diagrams.md) - System architecture
  • β€”[Deployment Guide](docs/deployment_guide.md) - Detailed deployment instructions

πŸ” Security & Best Practices

  • β€”βœ… Never commit API keys to git (use .env and HF Secrets)
  • β€”βœ… Use environment variables for all sensitive data
  • β€”βœ… Rotate API keys regularly
  • β€”βœ… Check .env.example for required variables
  • β€”βœ… Run guardrail engine for all user inputs
  • β€”βœ… Validate all responses before serving

πŸ› Troubleshooting

App won't start locally

bash
# Clear Streamlit cache
rm -rf ~/.streamlit

# Reinstall dependencies
pip install --upgrade -r requirements.txt

# Run with debug
streamlit run app.py --logger.level=debug

Import errors on HF Spaces

Check that the Dockerfile correctly sets WORKDIR /app and the app.py file has:

python
import sys
sys.path.insert(0, '.')

API key errors

Verify in HF Space Settings β†’ Repository secrets that:

  • β€”Secret names match exactly (case-sensitive)
  • β€”Secret values are correct
  • β€”Spaces have propagated the secrets (wait 30 seconds after adding)

Slow generation times

  • β€”First run cold-starts may take 30-60 seconds
  • β€”Use GPT-3.5-turbo instead of GPT-4o for speed
  • β€”Consider upgrading HF Space hardware for faster responses

πŸš€ Deployment to Hugging Face Spaces

Quick Start

  1. 1.Create a Space on HF: https://huggingface.co/spaces
  2. 2.Select Docker as SDK
  3. 3.Link your GitHub repository
  4. 4.Add required secrets in Settings
  5. 5.Space auto-deploys on each push

Detailed Steps

See Deployment Guide for step-by-step instructions.


πŸ“Š Performance Metrics

MetricValue
Startup Time30-60s (first load), 10-20s (warm)
Query Response20-40s (including LLM inference)
Memory Usage~2-4GB (base), 6-8GB (with models)
Concurrent Users1-2 (free tier), upgradeable
API Rate LimitsDepends on provider keys

πŸ“ License

MIT License - See LICENSE file for details


πŸ‘¨β€πŸ’» Development

Project Structure

ContentGenie/
β”œβ”€β”€ app.py                 # HF Spaces entry point
β”œβ”€β”€ Dockerfile             # Docker configuration
β”œβ”€β”€ requirements.txt       # Python dependencies
β”œβ”€β”€ README.md              # This file
β”œβ”€β”€ .env.example           # Environment template
β”œβ”€β”€ .gitignore             # Git exclusions
β”‚
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ agents/            # Multi-agent implementations
β”‚   β”‚   β”œβ”€β”€ base_agent.py
β”‚   β”‚   β”œβ”€β”€ query_handler.py
β”‚   β”‚   β”œβ”€β”€ research.py
β”‚   β”‚   β”œβ”€β”€ content_strategist.py
β”‚   β”‚   β”œβ”€β”€ blog_writer.py
β”‚   β”‚   └── ...
β”‚   β”‚
β”‚   β”œβ”€β”€ core/              # Core LLM & orchestration
β”‚   β”‚   β”œβ”€β”€ base_llm.py
β”‚   β”‚   β”œβ”€β”€ registry.py
β”‚   β”‚   β”œβ”€β”€ factory.py
β”‚   β”‚   └── guardrail_engine.py
β”‚   β”‚
β”‚   β”œβ”€β”€ integrations/      # External service clients
β”‚   β”‚   β”œβ”€β”€ content_client.py
β”‚   β”‚   β”œβ”€β”€ research_client.py
β”‚   β”‚   β”œβ”€β”€ visual_client.py
β”‚   β”‚   └── ...
β”‚   β”‚
β”‚   β”œβ”€β”€ utils/             # Utility functions
β”‚   β”‚   β”œβ”€β”€ formatter.py
β”‚   β”‚   β”œβ”€β”€ content_optimization.py
β”‚   β”‚   └── quality_validation.py
β”‚   β”‚
β”‚   β”œβ”€β”€ config/            # Configuration files
β”‚   β”‚   β”œβ”€β”€ intents.yaml
β”‚   β”‚   β”œβ”€β”€ guardrails.yaml
β”‚   β”‚   └── services.yaml
β”‚   β”‚
β”‚   β”œβ”€β”€ docs/              # Documentation
β”‚   β”‚   β”œβ”€β”€ api_response_formats.md
β”‚   β”‚   β”œβ”€β”€ architecture_diagrams.md
β”‚   β”‚   └── deployment_guide.md
β”‚   β”‚
β”‚   └── web_app/           # Streamlit UI
β”‚       β”œβ”€β”€ app.py
β”‚       β”œβ”€β”€ components/
β”‚       β”œβ”€β”€ assets/
β”‚       └── data/
β”‚
└── tests/                 # Unit & integration tests
    β”œβ”€β”€ unit/
    β”œβ”€β”€ integration/
    └── e2e/

🀝 Contributing

Contributions welcome! Please:

  1. 1.Fork the repository
  2. 2.Create a feature branch (git checkout -b feature/amazing-feature)
  3. 3.Commit changes (git commit -m 'Add amazing feature')
  4. 4.Push to branch (git push origin feature/amazing-feature)
  5. 5.Open a Pull Request

πŸ“ž Support

  • β€”Issues: Open a GitHub issue for bugs
  • β€”Discussions: Use GitHub Discussions for questions
  • β€”Email: [your-email@example.com]
  • β€”HF Community: Post in Hugging Face forums

πŸŽ‰ Acknowledgments

Built with:


Made with ❀️ for content creators and developers

Last updated: February 2026