建構多模態生成式 AI 應用程式:挑戰實驗室

Lab 15 minutes universal_currency_alt No cost show_chart Introductory
info This lab may incorporate AI tools to support your learning.
Lab instructions and tasks
This content is not yet optimized for mobile devices.
For the best experience, please visit us on a desktop computer using a link sent by email.

Google Cloud 自學實驗室

總覽

在挑戰實驗室中,您會在特定情境下完成一系列任務。挑戰實驗室中沒有逐步說明,請運用從課程實驗室學到的知識和技巧,獨立完成任務!自動評分系統 (如本頁所示) 會解析您是否正確完成工作。

挑戰實驗室中不會介紹新的 Google Cloud 概念。請活用所學技巧來解決問題,例如變更預設值、閱讀研究錯誤訊息。

如果想拿滿分,就必須在時限內完成所有任務!準備好迎接挑戰了嗎?

  • 實驗室活動會計時且無法暫停,點選「Start Lab」後就會開始計時。
  • 內建的 Cloud 終端機已預先設定了 gcloud SDK。
  • 使用終端機執行指令,然後點選「Check my progress」,確認工作已完成。

挑戰情境

情境:您是 AI 花藝設計公司的開發人員。客戶描述想要的花束樣貌後,系統會生成逼真圖片請客戶確認。為了進一步提升體驗,您整合最先進的圖像分析技術,為生成的花束圖片提供描述性摘要。主應用程式會根據使用者的互動叫用相關方法,因此您需要完成下列工作:

工作 1:開發一個 Python 函式,命名為 generate_bouquet_image(prompt)。這個函式應使用輸入的提示詞叫用 imagen-3.0-generate-002 模型來生成圖片,並儲存至本機。請使用這個提示詞:Create an image containing a bouquet of 2 sunflowers and 3 roses

點選「Check my progress」確認目標已達成。

傳送文字提示詞來生成圖片

工作 2:開發第二個 Python 函式,命名為 analyze_bouquet_image(image_path)。這個函式會將圖片路徑和文字提示詞做為輸入內容,根據傳入的圖片生成生日祝福,並傳送至 gemini-2.0-flash-001 模型。請在提示詞中啟用串流功能,確保回應生成時,您能立即取得。

點選「Check my progress」確認目標已達成。

使用多模態模型分析儲存的圖片

恭喜!

您已完成這個實驗室!很棒!

Copyright 2026 Google LLC 保留所有權利。Google 和 Google 標誌是 Google LLC 的商標,其他公司和產品名稱則有可能是其關聯公司的商標。

Before you begin

  1. Labs create a Google Cloud project and resources for a fixed time
  2. Labs have a time limit and no pause feature. If you end the lab, you'll have to restart from the beginning.
  3. On the top left of your screen, click Start lab to begin

Use private browsing

  1. Copy the provided Username and Password for the lab
  2. Click Open console in private mode

Sign in to the Console

  1. Sign in using your lab credentials. Using other credentials might cause errors or incur charges.
  2. Accept the terms, and skip the recovery resource page
  3. Don't click End lab unless you've finished the lab or want to restart it, as it will clear your work and remove the project

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

One lab at a time

Confirm to end all existing labs and start this one

Use private browsing to run the lab

Using an Incognito or private browser window is the best way 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.