Skip to content

This project allows to help up with Gemini to generate some images & videos

License

Notifications You must be signed in to change notification settings

zenika-open-source/agent-Z-communication-assistant

Repository files navigation

Agent Z communication assistant πŸ€–

Version License: MIT Java Quarkus GitHub

This Quarkus project uses Gemini and google-genai library to generate images from templates. This allows us to save time for our social network communication.

⚠️ Be careful about the images you use. Please contact the person if you are using their images before using them and integrating them into this API.

πŸ™Œ Features

  • πŸš€ Quarkus Framework: Fast startup and low memory footprint
  • πŸ€– Gemini AI Integration: Uses Google's latest Gemini models
  • 🎨 Image Generation: Creates images from pre-configured templates for blog posts and conference speakers
  • πŸŽ₯ Video Generation: Generate videos with Veo models
  • πŸ’» Picocli CLI: Rich command-line interface with comprehensive options
  • πŸ“ Post Generation: Generate LinkedIn & Bluesky posts
  • 🎯 Multiple Templates: Support for single and dual-author/speaker templates

πŸ› οΈ Prerequisites

  • Java 17 or higher
  • Maven 3.8+
  • Google AI API Key

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

  1. Clone the repository

    git clone git@github.com:zenika-open-source/agent-Z-communication-assistant.git
    cd agent-Z-communication-assistant
  2. Set up your Google AI API Key

    Option A: Environment Variable (Recommended)

    export GOOGLE_API_KEY=your-api-key-here

    Option B: Configuration File

    # Edit src/main/resources/application.properties
    google.ai.api.key=your-api-key-here
  3. Run the project

    mvn quarkus:dev -Dquarkus.args="ui"

The web interface will be available at http://localhost:8501.

🐳 Docker

You can also run the application using Docker:

  1. Build the container image:

    ./mvnw package
    docker build -f Dockerfile -t quarkus/agent-z-communication .
  2. Run the container:

    The container exposes port 8080 (Quarkus) and 8501 (Javelit UI). It also needs your Google API credentials.

    docker run -i --rm \
      -p 8080:8080 \
      -p 8501:8501 \
      -e GOOGLE_API_KEY=$GOOGLE_API_KEY \
      -e GOOGLE_CLOUD_PROJECT_ID=$GOOGLE_CLOUD_PROJECT_ID \
      -e GOOGLE_CLOUD_LOCATION=$GOOGLE_CLOUD_LOCATION \
      -v $(pwd)/generated:/deployments/generated \
      quarkus/agent-z-communication

    The web interface will be available at http://localhost:8501.

☁️ Deploy to Google Cloud Run

To deploy the application to Cloud Run:

  1. Build the JAR:

    mvn clean package
  2. Submit the build to Cloud Build:

    gcloud run deploy agent-z-communication-assistant \
    --source . \
    --region $GOOGLE_CLOUD_LOCATION \
    --project $GOOGLE_CLOUD_PROJECT_ID \
    --allow-unauthenticated \
    --memory 1Gi \
    --max-instances 1 \
    --set-env-vars="GOOGLE_CLOUD_PROJECT=$GOOGLE_CLOUD_PROJECT_ID,GOOGLE_CLOUD_LOCATION=$GOOGLE_CLOUD_LOCATION,GOOGLE_GENAI_USE_VERTEXAI=$GCLOUD_GENAI_USE_VERTEXAI,GOOGLE_API_KEY=$GOOGLE_API_KEY"

    Note: The application listens on port 8501 (Javelit UI). We configure Cloud Run to route traffic to this port.

πŸš€ Usage

Web Interface (UI)

The easiest way to use the assistant is via the web interface:

  1. Start the application
  2. Open http://localhost:8501 in your browser
  3. Select a template and fill in the fields
  4. Click on the GENERATE button

Command Line Interface

The application provides several pre-configured templates for different use cases:

Image Templates

  1. generate-image-blog-post - Generate an image for a blog post (single author)

    • Fields: NAME, TITLE, PHOTO
  2. generate-image-2-blog-post - Generate an image for a blog post with 2 authors

    • Fields: NAME, NAME2, TITLE, PHOTO, PHOTO2
  3. generate-image-speaker-event - Generate an image to announce a speaker for a conference

    • Fields: NAME, TITLE, CONF_PHOTO, PHOTO
  4. generate-image-2-speaker-event - Generate an image to announce a talk with 2 speakers

    • Fields: NAME, NAME2, TITLE, PHOTO, PHOTO2, CONF_PHOTO
  5. generate-image-from-prompt - Generate an image from a prompt

    • Fields: PROMPT
  6. generate-image-duck-from-prompt - Generate an image from a prompt with the Zenika duck

    • Fields: PROMPT

Video Templates

  1. generate-video-speaker-event - Generate a video to announce a speaker for a conference

Text Templates

  1. generate-post-speaker-event - Generate LinkedIn & Bluesky posts

Command Line Interface

Quick examples:

# Show help
quarkus dev -Dquarkus.args="--help"

# Generate image for a blog post (single author)
quarkus dev -Dquarkus.args="image --template-name generate-image-blog-post --title=IntroductiontoDuckDB --name=John_Doe --photo=images/people/john-doe.png -o output.png"

# Generate image for a blog post (2 authors)
quarkus dev -Dquarkus.args="image --template-name generate-image-2-blog-post --title=Exploring_Firebas_Studio --name=Alice-Smith --name2=Bob_Johnson --photo=images/people/alice.png --photo2 images/people/bob.png -o output.png"

# Generate image for a conference speaker
quarkus dev -Dquarkus.args="image --template-name generate-image-speaker-event --title=My_Great_Talk --name=Speaker_Name --photo=images/people/speaker.png --conf-photo=images/logos/conference.png -o output.png"

# Generate image for a conference with 2 speakers
quarkus dev -Dquarkus.args="image --template-name generate-image-2-speaker-event --title=Firebase_Studio --name=Speaker_1 --name2=Speaker_2 --photo images/people/peolple1.png --photo2=images/people/people2.png --conf-photo=images/logos/conference.png -o output.png"

# Generate image from a prompt
quarkus dev -Dquarkus.args="image --template-name generate-image-from-prompt --prompt='A futuristic city with flying cars' -o output.png"

# Generate video
quarkus dev -Dquarkus.args="video --prompt 'Conference intro' --vertex"

Running the Application

With CLI arguments:

quarkus dev -Dquarkus.args="--type image --prompt 'Your prompt here' --output result.png"

Production mode:

# Build
mvn clean package

# Run
java -jar target/quarkus-app/quarkus-run.jar --help

# Example: Generate image for a speaker event
java -jar target/quarkus-app/quarkus-run.jar image --template-name generate-image-speaker-event --title "My Great Talk" --name "Speaker Name" --photo images/people/speaker-photo.png --conf-photo images/logos/conference.png -o output.png

Configuration

The application can be configured through src/main/resources/application.properties:

# Google AI Configuration
google.ai.api.key=your-api-key-here

# Gemini Model Settings
app.gemini.model=gemini-2.0-flash-exp
app.gemini.model.veo=veo-2.0
app.result.filename=gemini-generation-image.png

# Video Generation Configuration
app.video.ratio=16:9
app.video.resolution=1080p

# Quarkus Configuration
quarkus.http.port=8080
quarkus.log.level=INFO

Key Configuration Options

  • google.ai.api.key: Your Google AI API key (required)
  • app.gemini.model: Gemini model for image generation (default: gemini-2.0-flash-exp)
  • app.gemini.model.veo: Veo model for video generation (default: veo-2.0)
  • app.result.filename: Default output filename for generated images
  • app.video.ratio: Video aspect ratio (e.g., 16:9, 9:16, 1:1)
  • app.video.resolution: Video resolution (e.g., 1080p, 720p, 4k)

Templates

Templates are defined in src/main/resources/templates.json. Each template specifies:

  • name: Unique identifier for the template
  • description: Human-readable description
  • type: Template type (IMAGE, VIDEO, or POST)
  • template: Path to the template image file
  • fields: Required fields for the template
  • prompt: AI prompt used to generate the content

To add a new template, edit templates.json and add a corresponding handler in GenerateImageCommand.java.

Supported Image Formats

The application automatically detects and supports the following image formats:

  • PNG (.png) - Recommended for templates with transparency
  • JPEG (.jpg, .jpeg) - Good for photographic templates
  • GIF (.gif) - Supports animated templates
  • WebP (.webp) - Modern format with good compression

πŸ™Œ Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes using gitmoji commits (git commit -m ':sparkles: add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

⁉️ Support

For support and questions:

πŸ“’ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Authors

  • Jean-Philippe Baconnais (@jeanphi-baconnais)

πŸ™ Contributors


Jean-Phi Baconnais

Benjamin

with love by zenika

About

This project allows to help up with Gemini to generate some images & videos

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •