# ✨ LinkedIn Carousel Generator A complete application that automatically generates professional, highly visual LinkedIn carousels from simple text or articles using Google's **Gemini 3 Pro** (for advanced reasoning and content structuring) and **Gemini 3 Image** (for high-quality, style-consistent backgrounds). Built with **Python**, **Streamlit**, and the latest **Google GenAI SDK**. --- ## 🚀 Features - **Automated Content Generation**: Extracts key points from any text or article and structures them into a compelling multi-slide narrative optimized for LinkedIn. - **AI Image Generation**: Dynamically creates unique, high-quality background images tailored to the content of each slide using Gemini's image models. - **Consistent Styling**: Supports multiple visual styles or a custom user-uploaded reference image to maintain brand consistency across all slides. - **Auto-Formatting**: Automatically overlays text, headlines, and code snippets onto the generated backgrounds using Python Pillow. - **Cost Estimation**: Provides real-time token and cost estimation for transparency. - **Multi-Language Support**: Generate carousels in over 10 different languages. - **Export Ready**: Download all generated slides as a ZIP file, ready to be converted to PDF and posted directly to LinkedIn. ## 🛠️ Tech Stack - **Frontend**: [Streamlit](https://streamlit.io/) - **AI Models**: Google Gemini (via `google-genai` SDK) - **Image Processing**: [Pillow (PIL)](https://python-pillow.org/) - **Deployment**: Docker & Docker Compose --- ## 📦 Getting Started ### Prerequisites - A **Google Gemini API Key**. You can get one from [Google AI Studio](https://aistudio.google.com/). - **Docker** and **Docker Compose** (Recommended) or **Python 3.10+** (for local development). ### Option 1: Running with Docker (Recommended) The easiest way to run the application is using Docker Compose. 1. **Clone the repository** (if you haven't already) and navigate to the project directory: ```bash cd linkedin-carousel-generator ``` 2. **Run the application**: You can either export your API key first or pass it inline: ```bash export GOOGLE_API_KEY="your_api_key_here" docker compose up --build -d ``` *Alternatively, you can provide the API key later through the web UI.* 3. **Access the app**: Open your browser and navigate to [http://localhost:8501](http://localhost:8501). ### Option 2: Local Python Setup 1. **Navigate to the app directory**: ```bash cd linkedin-carousel-generator/linkedin_carousel_app ``` 2. **Create a virtual environment**: ```bash python -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate` ``` 3. **Install the dependencies**: ```bash pip install -r requirements.txt ``` 4. **Run the application**: ```bash streamlit run app.py ``` --- ## 🏗️ Project Structure ```text linkedin-carousel-generator/ ├── Dockerfile # Container definition for the app ├── docker-compose.yml # Compose file for easy deployment ├── .dockerignore # Files to exclude from Docker builds ├── linkedin_carousel_app/ # Main application source code │ ├── app.py # Main Streamlit UI and execution logic │ ├── generator.py # Integration with Google Gemini for Text & Images │ ├── styles.py # Configuration for visual styles and layouts │ ├── utils.py # Helper functions (Image formatting, fonts, etc.) │ └── requirements.txt # Python dependencies └── README.md # Project documentation ``` ## 💡 How to Use 1. **Enter API Key**: Open the settings sidebar and paste your Gemini API Key if you haven't set it via environment variables. 2. **Paste Text**: In the main area, paste the article, blog post, or ideas you want to convert into a carousel. 3. **Configure**: Select an output language and visual style (e.g., Tech Minimalist, Bold Gradient). 4. **Generate**: Click "Generate Carousel". The app will first break down your text into slides, and then generate imagery for each one concurrently. 5. **Download**: Once finished, preview the slides in the app and click the download button to get a ZIP archive of your completed carousel. *(Tip: To post on LinkedIn as a swipeable carousel, convert the downloaded images into a single PDF document first).*