This page walks through setting up your Google Cloud project to use
Gemini Enterprise Agent Platform and downloading some TensorFlow code for training. You will
also download code for a web app that gets predictions.
This tutorial has several pages:

<br />

1. Setting up your project and environment.

2. [Training a custom image classification
   model.](https://docs.cloud.google.com/gemini-enterprise-agent-platform/machine-learning/tutorials/image-classification-custom/training)

3. [Serving predictions from a custom image classification
   model.](https://docs.cloud.google.com/gemini-enterprise-agent-platform/machine-learning/tutorials/image-classification-custom/serving)

4. [Cleaning up your project.](https://docs.cloud.google.com/gemini-enterprise-agent-platform/machine-learning/tutorials/image-classification-custom/cleanup.md.txt)

Each page assumes that you have already performed the instructions from the
previous pages of the tutorial.

## Before you begin

Throughout this tutorial, use Google Cloud console and
[Cloud Shell](https://docs.cloud.google.com/shell/docs.md.txt) to interact with Google Cloud. Alternatively,
instead of Cloud Shell, you
can use another Bash shell with the [Google Cloud CLI](https://docs.cloud.google.com/sdk/docs.md.txt) installed.

1. In the Google Cloud console, activate Cloud Shell.

   [Activate Cloud Shell](https://console.cloud.google.com/?cloudshell=true)


   At the bottom of the Google Cloud console, a
   [Cloud Shell](https://docs.cloud.google.com/shell/docs/how-cloud-shell-works.md.txt)
   session starts and displays a command-line prompt. Cloud Shell is a shell environment
   with the Google Cloud CLI
   already installed and with values already set for
   your current project. It can take a few seconds for the session to initialize.
2. If Cloud Shell does not display
   `(PROJECT_ID)$`
   in its prompt (where <var translate="no">PROJECT_ID</var> is replaced by your
   Google Cloud project ID), then run the following command to
   configure Cloud Shell to use your project:

   ```bash
   gcloud config set project PROJECT_ID
   ```

## Create a Cloud Storage bucket

Create a regional [Cloud Storage](https://docs.cloud.google.com/storage/docs.md.txt) bucket in the `us-central1`
region to use for the rest of this tutorial. As you follow the tutorial, use the
bucket for several purposes:

- Store training code for Agent Platform to use in a custom training job.
- Store the model artifacts that your custom training job outputs.
- Host the web app that gets predictions from your Agent Platform endpoint.

To create the Cloud Storage bucket, run the following command in your
Cloud Shell session:

```bash
gcloud storage buckets create gs://BUCKET_NAME --project=PROJECT_ID --location=us-central1
```

Replace the following:

- <var translate="no">PROJECT_ID</var>: The ID of your Google Cloud project.
- <var translate="no">BUCKET_NAME</var>: A name that you choose for your bucket. For example, `hello_custom_PROJECT_ID`. Learn about [requirements for bucket
  names](https://docs.cloud.google.com/storage/docs/buckets#naming).

## Download sample code

Download sample code to use for the rest of the tutorial.

```bash
gcloud storage cp gs://cloud-samples-data/ai-platform/hello-custom/hello-custom-sample-v1.tar.gz - | tar -xzv
```

To optionally view the sample code files, run the following command:

```bash
ls -lpR hello-custom-sample
```

The `hello-custom-sample` directory has four items:

- `trainer/`: A directory of TensorFlow Keras code for training the flower
  classification model.

- `setup.py`: A configuration file for packaging the `trainer/` directory into
  a Python source distribution that Agent Platform can use.

- `function/`: A directory of Python code for a
  [Cloud Run function](https://docs.cloud.google.com/functions/docs.md.txt) that can receive and preprocess
  prediction requests from a web browser, send them to Agent Platform,
  process the prediction responses, and send them back to the browser.

- `webapp/`: A directory with code and markup for a web app that gets flower
  classification predictions from Agent Platform.

## What's next

Follow the [next page of this tutorial](https://docs.cloud.google.com/gemini-enterprise-agent-platform/machine-learning/tutorials/image-classification-custom/training.md.txt) to run a custom
training job on Agent Platform.