arrow_back

Use Vertex AI Studio for Healthcare

Sign in Join
Test and share your knowledge with our community!
done
Get access to over 700 hands-on labs, skill badges, and courses

Use Vertex AI Studio for Healthcare

Lab 1 hour universal_currency_alt 1 Credit show_chart Introductory
info This lab may incorporate AI tools to support your learning.
Test and share your knowledge with our community!
done
Get access to over 700 hands-on labs, skill badges, and courses

GSP1252

Google Cloud self-paced labs logo

Disclaimer: The information in this course is for educational purposes only, and does not serve as Google's approval for use of its generative AI service for any diagnostic or therapeutic purpose, or for direct patient care.

Overview

Vertex AI is a powerful machine learning platform designed to enhance healthcare applications with both predictive and generative AI capabilities. Vertex AI Studio serves as an intuitive interface, allowing healthcare practitioners and researchers to easily experiment with and customize generative AI models without extensive machine learning expertise. This user-friendly platform provides a variety of tools and resources, including UI-based interactions and code examples, making it simple to harness the power of generative AI for healthcare applications.

In this hands-on lab, you'll delve into Vertex AI Studio, where you'll explore the capabilities of cutting-edge generative AI models like Gemini multimodal. With Gemini, you'll experiment with prompt design techniques to summarize text, answer questions, and classify sentiments. All of this can be done directly within the Google Cloud console, without the need for complex APIs or Python SDKs, making it accessible to healthcare professionals with varying levels of technical expertise.

Objectives

In this lab, you will learn how to:

  • Analyze images with Gemini multimodal.
  • Explore multimodal capabilities.
  • Design prompts with free-form and structured mode.
Note: Please do not enter any Personally identifiable information (PII) in this educational lab. PII can include a person's name, address, phone number, email address, Social Security number, date of birth, driver's license number, financial information, and medical records. It can also include biometrics, photographs, and internet protocol (IP) addresses.

Setup and requirements

Before you click the Start Lab button

Read these instructions. Labs are timed and you cannot pause them. The timer, which starts when you click Start Lab, shows how long Google Cloud resources will be made available to you.

This hands-on lab lets you do the lab activities yourself in a real cloud environment, not in a simulation or demo environment. It does so by giving you new, temporary credentials that you use to sign in and access Google Cloud for the duration of the lab.

To complete this lab, you need:

  • Access to a standard internet browser (Chrome browser recommended).
Note: Use an Incognito or private browser window to run this lab. This prevents any conflicts between your personal account and the Student account, which may cause extra charges incurred to your personal account.
  • Time to complete the lab---remember, once you start, you cannot pause a lab.
Note: If you already have your own personal Google Cloud account or project, do not use it for this lab to avoid extra charges to your account.

How to start your lab and sign in to the Google Cloud console

  1. Click the Start Lab button. If you need to pay for the lab, a pop-up opens for you to select your payment method. On the left is the Lab Details panel with the following:

    • The Open Google Cloud console button
    • Time remaining
    • The temporary credentials that you must use for this lab
    • Other information, if needed, to step through this lab
  2. Click Open Google Cloud console (or right-click and select Open Link in Incognito Window if you are running the Chrome browser).

    The lab spins up resources, and then opens another tab that shows the Sign in page.

    Tip: Arrange the tabs in separate windows, side-by-side.

    Note: If you see the Choose an account dialog, click Use Another Account.
  3. If necessary, copy the Username below and paste it into the Sign in dialog.

    {{{user_0.username | "Username"}}}

    You can also find the Username in the Lab Details panel.

  4. Click Next.

  5. Copy the Password below and paste it into the Welcome dialog.

    {{{user_0.password | "Password"}}}

    You can also find the Password in the Lab Details panel.

  6. Click Next.

    Important: You must use the credentials the lab provides you. Do not use your Google Cloud account credentials. Note: Using your own Google Cloud account for this lab may incur extra charges.
  7. Click through the subsequent pages:

    • Accept the terms and conditions.
    • Do not add recovery options or two-factor authentication (because this is a temporary account).
    • Do not sign up for free trials.

After a few moments, the Google Cloud console opens in this tab.

Note: To view a menu with a list of Google Cloud products and services, click the Navigation menu at the top-left. Navigation menu icon

Enable the Vertex AI API

  1. In the Google Cloud Console, enter Vertex AI API in the top search bar.

  2. Click on the result for Vertex AI API under Marketplace & APIs.

  3. Click Enable.

Enable Vertex AI API

Click Check my progress to verify the objectives.

Enable the Vertex AI API.

Task 1. Analyze images with Gemini multimodal

  1. In the Google Cloud console, from the Navigation menu (Navigation menu), select Vertex AI > Vertex AI Studio > Overview.

You find four features: Multimodal, Language, Vision, and Speech.

Vertex AI Studio Overview page

  1. Under Multimodal powered by Gemini, click Try Gemini.

The UI contains three main sections:

  • Prompt (located at the top): Here, you can create a task that utilizes multimodal capabilities.
  • Configuration (located on the right): This section allows you to select models, configure parameters, and obtain the corresponding code.
  • Response (located at the bottom): This section displays the results of your task. Vertex AI Studio
  1. On the top left, click Untitled Prompt and rename your prompt as Medical Image Analysis.

  2. On the top right under Model, select the gemini-1.5-pro model.

  3. Download the sample image. Right-click the chest x-ray image and then save it to your desktop.

chest x-ray graphic

  1. Click Insert media > Upload from computer on top right and upload the x-ray image. The media can be either images or videos.

Insert media into Vertex AI Studio

  1. The image will be displayed inside of the Prompt section. Copy the following text and paste it under the image and click Submit.
Title the image.

Or be more specific:

Title the image in 3 words.

Does the title meet your expectations? Try to modify the prompt to see if you get different results.

  1. Describe the image. Replace the previous prompt with the following and click Submit.
Describe the image in detail.
  1. Tune the parameter. Adjust the temperature by scrolling from left (0) to right (2). Resubmit the prompt to observe any changes in the outcome compared to the previous result.
Note: Temperature controls the degree of randomness in token selection. Lower temperatures are good for prompts that expect a true or correct response, while higher temperatures can lead to more diverse, unexpected, or potentially biased results. With a temperature of 0 the highest probability token is always selected.
  1. Extract information from the image. Replace the previous prompt with the following:
What conditions could this image indicate?

Further on, if you want to format the output to a list, replace the previous prompt with the following:

What conditions could this image indicate? Format the output as a list from greatest to least likely.

Your turn - try out some different prompts! How do these results differ from before?

Does the result meet your expectations? You are highly encouraged to try different prompts for various tasks. You are also encouraged to experiment with different temperature settings to observe the changes in the result.

  1. Once you finish the prompt design, save the prompt by clicking Save on the top right of the Configuration section. For the region, select from the dropdown and then confirm by clicking Save.

To find your saved prompts, navigate to Multimodal > My prompts.

Note: After selecting Save, give the prompts a few seconds to properly save and then proceed further with the lab. Click "Try again" if prompted "failed to update history."

Click Check my progress to verify the objectives.

Extract the content of the image.

Task 2. Explore multimodal capabilities

In addition to images and text, Gemini multimodal is capable of accepting videos as inputs and generating text as an output. To obtain the video, you will click on a link to a lung animation video, save the video to your desktop and upload the video into Vertex AI Studio.

  1. Click this link to the lung animation video. The video should appear in your web browser. Right-click on the video to save the video to your computer.
  1. Navigate back to the Vertex AI Studio > Overview page and click Try Gemini.

  2. On the top right under Model, select the gemini-1.5-pro model.

  3. Click Insert Media > Upload from computer. Select the lung animation video you downloaded and click Open.

  4. Generate any information about the video by inserting your own prompt.

For example, to describe the video in detail, copy the following into the Prompt section and click Submit.

Describe this video in detail.
  1. On the top left, click Untitled Prompt and rename your prompt as Medical Video Analysis.

  2. Once you finish the prompt design, save the prompt by clicking Save on the top right of the Configuration section. For the region, select from the dropdown and then confirm by clicking Save.

Multimodal powered by Gemini offers many capabilities such as writing simple explanations of complex images, analyzing videos, and generating educational multimedia visual aids. Explore more multimodal use cases by clicking Multimodal > Sample Prompts. Check out more information about design multimodal prompts.

Click Check my progress to verify the objectives.

Extract the content of the video.

Task 3. Design prompts with free-form and structured mode

  1. Navigate back to the Vertex AI Studio > Overview page.

  2. Click Open for Language Powered by Gemini.

Create prompt

Create Prompt lets you design prompts for tasks relevant to your healthcare use case.

  1. Click on the Text Prompt button as shown in the image below. The UI may differ slightly from this screenshot.

click-text-prompt

You can hover or click on ? buttons on the right side of the page to learn more about each field and parameter such as Temperature and Token limit.

Prompt design

You can feed your desired input text, e.g. a question, to the model. The model will then provide a response based on how you structured your prompt. The process of figuring out and designing the best input text (prompt) to get the desired response back from the model is called Prompt Design.

Prompt design methods

There is no best way to design the prompts yet. There are 3 methods you can use to shape the model's response:

  • Zero-shot prompting - This is a method where the LLM is given only a prompt that describes the task and no additional data. For example, if you want the LLM to answer a question, you just prompt "what is prompt design?".
  • One-shot prompting - This is a method where the LLM is given a single example of the task that it is being asked to perform. For example, if you want the LLM to write a poem, you might give it a single example poem.
  • Few-shot prompting - This is a method where the LLM is given a small number of examples of the task that it is being asked to perform. For example, if you want the LLM to write a news article, you might give it a few news articles to read.

Free-form and structured mode

You may also notice the FREE-FORM and STRUCTURED tabs. Those are the two modes that you can use when designing your prompt.

  • Free-form - This mode provides a free and easy approach to design your prompt. It is suitable for small and experimental prompts with no additional examples. You will be using this to explore zero-shot prompting.
  • Structured - This mode provides an easy-to-use template approach to prompt design. Context and multiple examples can be added to the prompt in this mode. This is especially useful for one-shot and few-shot prompting methods which you will be exploring later.

Parameters

Temperature and Token limit are two important parameters that you can adjust to influence the model's response.

  • Temperature controls the randomness in token selection. A lower temperature is good when you expect a true or correct response. A temperature of 0 means the highest probability token is always selected. A higher temperature can lead to diverse, unexpected, or potentially biased results. The gemini-1.5-pro model has a temperature range of 0 - 2 and a default of 1.
  • Output token limit determines the maximum amount of text output from one prompt. A token is approximately four characters.

Free-form mode

Try zero-shot prompting in Free-form mode.

  1. On the top right under Model, select the gemini-1.5-pro model.
Note: The model name may change with the release of new models.
  1. Copy the following over to the prompt input field:
Generate a list of common medical conditions.
  1. Click on the SUBMIT button on the right side of the page.

The model will respond with a list of common medical conditions.

Here are some exploratory exercises to explore.

  • Adjust the Output Token limit parameter to 1024 and click the SUBMIT button.
  • Adjust the Temperature parameter to 0.5 and click the SUBMIT button.
  • Adjust the Temperature parameter to 2.0 and click the SUBMIT button.

Inspect how the responses change with different parameters.

  1. Copy the following over to the prompt input field.
Describe the underlying mechanism of Type 1 diabetes.
  1. Click on the SUBMIT button on the right side of the page.

The model will respond with a detailed explanation of the underlying mechanism of Type 1 diabetes.

  1. Next, copy the following over to the prompt input field.
Describe common treatments for a sprained ankle.
  1. Click on the SUBMIT button on the right side of the page.

The model will respond with a list of common treatments for a sprained ankle.

Structured mode

With Structured mode, you can design prompts in more organized ways. You can provide Context and Examples in their respective input fields. This is a good opportunity to learn one-shot and few-shot prompting.

In this section, you will design prompts for one-shot and few-shot prompting.

One-shot prompting

  1. Still on the Text Prompt page, click on the STRUCTURED tab. The prompt design page will change to a structured mode.

Structured prompt design page

  1. Remove any text from the Context field. Add the following:
Generate explanations of medical conditions. Simplify them to a 6th grade reading level.
  1. Under Examples field, copy the following in the INPUT field.
Arthritis
  1. Add the following to the OUTPUT field:
When your joints get swollen and sore
  1. Under Test field, copy the following in the INPUT field.
Diabetes
  1. Click on the SUBMIT button on the right side of the page.

The model will respond with an explanation of diabetes simplified to a 6th grade reading level.

Few-shot prompting

This time around, add a few examples for the model to base its output from.

  1. In the Context field, update the text to:
Generate explanations of medical conditions. Simplify them to a 6th grade reading level. Display them in a table.

Under Examples field, add the following examples, keeping your existing arthritis example from the previous section:

  1. Add this to the INPUT field:
Asthma
  1. Add this to the OUTPUT field:
When your airways get tight, making it hard to breathe
  1. Add this to the INPUT field:
Eczema
  1. Add this to the OUTPUT field:
When your skin gets dry, itchy, and red
  1. Under the Test field, copy the following in the INPUT field.
Cancer
  1. Click on the SUBMIT button on the right side of the page.

You have successfully influenced the way the model produces response. Your model now generates an explanation of cancer simplified to a 6th grade reading level, displayed in a table.

Text Summarization

For the next practice, you will use the model to summarize a paragraph into a single sentence.

  1. At the top of the page, click on the FREE-FORM tab. The prompt design page will change to the free-form mode. If prompted click Continue.

Free-form tab

  1. In the Prompt field, delete any existing text and copy the following:
Explain this paragraph in one sentence: Antibiotics are a type of medication used to treat bacterial infections. They work by either killing the bacteria or preventing them from reproducing, allowing the body's immune system to fight off the infection. Antibiotics are usually taken orally in the form of pills, capsules, or liquid solutions, or sometimes administered intravenously. They are not effective against viral infections, and using them inappropriately can lead to antibiotic resistance.
  1. Click on the SUBMIT button on the right side of the page.

The model will respond with the answer to the question (your response may vary):

Antibiotics are medications that fight bacterial infections by killing or stopping the growth of bacteria, allowing the body's immune system to eliminate the infection.

Question Answering

  1. In the Prompt field, delete any existing text and copy the following:
Answer the question based on the context below. Keep the answer short and concise. Respond "Unsure about answer" if not sure about the answer. Context: In 1847, Ignaz Semmelweis, a doctor in Vienna, noticed a significant difference in death rates between two maternity clinics. He observed that doctors in one clinic often went directly from autopsies to deliveries. Semmelweis suspected that "cadaverous particles" from autopsies were transferred to maternity patients via their hands, causing puerperal fever. He introduced a handwashing protocol using a chlorinated lime solution before patient contact. This intervention reduced mortality rates in the affected clinic. Question: What was the solution used for handwashing?
  1. Click on the SUBMIT button on the right side of the page.

The model will respond with the answer to the question (your response may vary):

Chlorinated lime solution.

Text Classification

  1. In the Prompt field, delete any existing text and copy the following:
Classify the text into neutral, negative or positive. Text: I think the hospital staff was ok.
  1. Click on the SUBMIT button on the right side of the page.

The model will respond with the answer to the question (your response may vary):

Neutral. The statement "I think the hospital staff was ok" does not express a clear positive or negative sentiment. It is a neutral statement that indicates the speaker's opinion on the hospital staff is neither particularly good nor bad.
  1. On the top left, click Untitled Prompt and rename your prompt as Text Classification.

  2. Save the prompt by clicking Save on the top right of the Configuration section. For the region, select from the dropdown and then confirm by clicking Save.

The saved prompt will appear at the MY PROMPTS tab.

Click Check my progress to verify the objectives.

Create prompts with text.

Congratulations!

Congratulations! In this lab, you explored the capabilities of Vertex AI Studio for Healthcare. You analyzed an image and video with Gemini multimodal and designed prompts with free-form and structured mode. You also explored zero-shot, one-shot, and few-shot prompting, as well as learned how to generate text summarization, question answering, and text classification. You are now ready to leverage the power of generative AI models.

Google Cloud training and certification

...helps you make the most of Google Cloud technologies. Our classes include technical skills and best practices to help you get up to speed quickly and continue your learning journey. We offer fundamental to advanced level training, with on-demand, live, and virtual options to suit your busy schedule. Certifications help you validate and prove your skill and expertise in Google Cloud technologies.

Manual Last Updated June 26, 2024

Lab Last Tested June 26, 2024

Copyright 2024 Google LLC All rights reserved. Google and the Google logo are trademarks of Google LLC. All other company and product names may be trademarks of the respective companies with which they are associated.

This content is not currently available

We will notify you via email when it becomes available

Great!

We will contact you via email if it becomes available