Google Cloud Generative AI Image Approver for Student Workshop

google-cloud-generative-ai-image-approver-for-student-workshop

Asking students to create a free Google Cloud Platform account to try Imagen on Vertex AI is impractical because it requires their own credit card. Moreover, students can be creative and mischievous, which could lead to embarrassing situations if the generated image is not reviewed by someone. Additionally, we need to preserve their prompt and generated images for an image generation game.

Solution

Our team has developed a serverless application called GenerativeAIImageApprover. Its purpose is to incorporate a review workflow into Imagen on Vertex AI. The application operates asynchronously and utilizes a group of Gmail accounts specifically designated for students and approvers.

Architecture

How does it work?

There are three categories of users: Admin, Student, and Approver. The Admin’s role is to generate a unique Gen Image URL for each student and set it as the default tab on each Chromebook.

The key is a randomly generated code set by the administrator during deployment. It serves as a basic form of authentication to generate a unique URL for generating images.

In this system, each student is paired with one approver. However, the administrator has the option to add a central approver who can review all generated images during deployment.

Here’s how the process works:

1. After the student inputs the prompt and clicks on “Gen Image,” the webpage sends an Ajax call to the “Gen Image” CloudFunction.

2. The system checks for the rate limit based on the student’s email address.

3. A new Gen Image Job is saved with status “GENERATING_IMAGE”.

4. The system calls Vertex AI to generate the image.

5. The generated image is uploaded to the static site bucket with a hashed image name.

6. An email is sent to the approver, which includes the generated image, an approval URL, and a rejection URL.

7. Update the Gen Image Job status to “WAITING_FOR_APPROVAL”.

When the Approver clicks on the approve URL, the “Approve Image” CloudFunction will perform the following steps:

1. It will check the status of the Gen Image Job. If this job has already been approved or rejected, the process will end.

2. It will generate a QR code using the public URL of the Gen Image.

3. It will send an email to the student containing the Gen Image, Gen Image URL, and QR code. This will allow the student to easily access the email using the QR code, without the need to forward it to their personal email due to privacy restrictions.

4. It will update the status of the Gen Image Job to “APPROVED”.

When the Approver clicks on the reject URL, the “Reject Image” CloudFunction will perform the following steps:

1. It will check the status of the Gen Image Job. If this job has already been approved or rejected, the process will end.

2. It will send an email to the student and ask students to try another prompt.

3. It will update the status of the Gen Image Job to “REJECTED”.

Source Code

https://github.com/wongcyrus/GenerativeAIImageApprover

Deployment

Please follow the README.

This project is using CDK for Terraform and I will share another blog for the details.

Conclusion

This application provides a solution for incorporating a review workflow into Imagen on Vertex AI. It addresses the impracticality of requiring students to create their own Google Cloud Platform accounts by utilizing designated Gmail accounts for students and approvers. The application operates asynchronously, allowing for efficient image generation and review processes. The architecture and functionality of the application have been outlined, including the steps involved in generating and approving/rejecting images. The source code for the application is available on GitHub, and deployment instructions are provided in the README. This application offers a practical and efficient solution for preserving prompt and generated images in an image generation game.

Author

Cyrus Wong is an accomplished senior lecturer who oversees the Higher Diploma program in Cloud and Data Centre Administration at the Department Information Technology of IVE(Lee Wai Lee) in Hong Kong. He is a passionate advocate for the adoption of cloud technology across various media and events. With his extensive knowledge and expertise, he has earned prestigious recognitions such as AWS Machine Learning Hero, Microsoft Azure MVP, and Google Developer Expert for Google Cloud Platform.

Connecting me: LinkedIn YouTube GitHub Twitter


Google Cloud Generative AI Image Approver for Student Workshop was originally published in Google Developer Experts on Medium, where people are continuing the conversation by highlighting and responding to this story.

Total
0
Shares
Leave a Reply

Your email address will not be published. Required fields are marked *

Previous Post
kistler-all-purpose-industrial-charge-amplifier

Kistler All-Purpose Industrial Charge Amplifier

Next Post
join-#mtpcon-and-pendomonium-on-our-2024-roadshow

Join #mtpcon and Pendomonium on our 2024 Roadshow

Related Posts