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.
- π 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
- Java 17 or higher
- Maven 3.8+
- Google AI API Key
-
Clone the repository
git clone git@github.com:zenika-open-source/agent-Z-communication-assistant.git cd agent-Z-communication-assistant -
Set up your Google AI API Key
Option A: Environment Variable (Recommended)
export GOOGLE_API_KEY=your-api-key-hereOption B: Configuration File
# Edit src/main/resources/application.properties google.ai.api.key=your-api-key-here -
Run the project
mvn quarkus:dev -Dquarkus.args="ui"
The web interface will be available at http://localhost:8501.
You can also run the application using Docker:
-
Build the container image:
./mvnw package docker build -f Dockerfile -t quarkus/agent-z-communication . -
Run the container:
The container exposes port
8080(Quarkus) and8501(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.
To deploy the application to Cloud Run:
-
Build the JAR:
mvn clean package
-
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.
The easiest way to use the assistant is via the web interface:
- Start the application
- Open http://localhost:8501 in your browser
- Select a template and fill in the fields
- Click on the GENERATE button
The application provides several pre-configured templates for different use cases:
-
generate-image-blog-post- Generate an image for a blog post (single author)- Fields:
NAME,TITLE,PHOTO
- Fields:
-
generate-image-2-blog-post- Generate an image for a blog post with 2 authors- Fields:
NAME,NAME2,TITLE,PHOTO,PHOTO2
- Fields:
-
generate-image-speaker-event- Generate an image to announce a speaker for a conference- Fields:
NAME,TITLE,CONF_PHOTO,PHOTO
- Fields:
-
generate-image-2-speaker-event- Generate an image to announce a talk with 2 speakers- Fields:
NAME,NAME2,TITLE,PHOTO,PHOTO2,CONF_PHOTO
- Fields:
-
generate-image-from-prompt- Generate an image from a prompt- Fields:
PROMPT
- Fields:
-
generate-image-duck-from-prompt- Generate an image from a prompt with the Zenika duck- Fields:
PROMPT
- Fields:
generate-video-speaker-event- Generate a video to announce a speaker for a conference
generate-post-speaker-event- Generate LinkedIn & Bluesky posts
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"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.pngThe 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=INFOgoogle.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 imagesapp.video.ratio: Video aspect ratio (e.g.,16:9,9:16,1:1)app.video.resolution: Video resolution (e.g.,1080p,720p,4k)
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, orPOST) - 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.
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
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes using gitmoji commits (
git commit -m ':sparkles: add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
For support and questions:
- Create an issue in the GitHub repository
- Check the Google AI documentation
- Review the Quarkus guides
This project is licensed under the MIT License - see the LICENSE file for details.
- Jean-Philippe Baconnais (@jeanphi-baconnais)
Jean-Phi Baconnais |
Benjamin |