Si aún no lo hiciste, sigue las siguientes instrucciones para configurar tu proyecto y crear un bucket de Cloud Storage.
Configura tu proyecto
Sign in to your Google Cloud account. If you're new to
Google Cloud,
create an account to evaluate how our products perform in
real-world scenarios. New customers also get $300 in free credits to
run, test, and deploy workloads.
In the Google Cloud console, on the project selector page,
select or create a Google Cloud project.
On the Create a bucket page, enter your bucket information. To go to the next
step, click Continue.
For Name your bucket, enter a unique bucket name. Don't include sensitive
information in the bucket name, because the bucket namespace is global and publicly
visible.
For Choose where to store your data, do the following:
Select a Location type option.
Select a Location option.
For Choose a default storage class for your data, select the following:
Standard.
For Choose how to control access to objects, select an Access control option.
En la sección Prueba este método, completa la plantilla interactiva del Explorador de APIs mediante el reemplazo de cloud-samples-data/vision en el campo image.source.imageUri con el nombre del bucket de Cloud Storage en el que subiste el archivo demo-img.jpg. El cuerpo de la solicitud se debe ver de la siguiente manera:
Haz clic en Ejecutar para enviar la solicitud al servicio. La respuesta JSON aparece después del cuerpo de la solicitud.
¡Felicitaciones! Realizaste tu primera solicitud images.annotate a Cloud Vision.
Realiza una limpieza
Para evitar cargos innecesarios de Google Cloud, usa la consola de Google Cloud para borrar tu bucket de Cloud Storage (y tu proyecto) si no los necesitas.
Usa las guías prácticas para obtener más información sobre funciones específicas, ver ejemplos de anotaciones y obtener anotaciones para un archivo o una imagen individuales.
Obtén más información sobre la anotación por lotes para imágenes y archivos (PDF, TIFF y GIF).
Explora una lista completa de las muestras de código de la biblioteca cliente.
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Información o código de muestra incorrectos","incorrectInformationOrSampleCode","thumb-down"],["Faltan la información o los ejemplos que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-09-04 (UTC)"],[],[],null,["# Quickstart: Detect labels in an image by using the Cloud Vision API\n\nDetect labels in an image by using the Cloud Vision API\n=======================================================\n\nThis quickstart shows you how to:\n\n- Create a Cloud Storage bucket.\n- Upload your image to Cloud Storage and make the file publicly accessible.\n- Make a request to the Vision API with that image.\n\nThese steps should take about five minutes to complete. You can [store up to\n5 GB of data in Cloud Storage for no\ncharge](/storage/pricing#cloud-storage-always-free) and make up to [1000 feature\nrequests](/vision/docs/pricing) per month to the Vision API for no\ncharge.\n\nBefore you begin\n----------------\n\nIf you haven't done so already, use the following instructions to set up your\nproject and create a Cloud Storage bucket.\n\n### Set up your project\n\n- Sign in to your Google Cloud account. If you're new to Google Cloud, [create an account](https://console.cloud.google.com/freetrial) to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.\n- In the Google Cloud console, on the project selector page,\n select or create a Google Cloud project.\n\n | **Note**: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.\n\n [Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n-\n [Verify that billing is enabled for your Google Cloud project](/billing/docs/how-to/verify-billing-enabled#confirm_billing_is_enabled_on_a_project).\n\n-\n\n\n Enable the Cloud Vision API.\n\n\n [Enable the API](https://console.cloud.google.com/flows/enableapi?apiid=vision.googleapis.com&redirect=https://console.cloud.google.com)\n\n- In the Google Cloud console, on the project selector page,\n select or create a Google Cloud project.\n\n | **Note**: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.\n\n [Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n-\n [Verify that billing is enabled for your Google Cloud project](/billing/docs/how-to/verify-billing-enabled#confirm_billing_is_enabled_on_a_project).\n\n-\n\n\n Enable the Cloud Vision API.\n\n\n [Enable the API](https://console.cloud.google.com/flows/enableapi?apiid=vision.googleapis.com&redirect=https://console.cloud.google.com)\n\n\u003cbr /\u003e\n\n### Create a Cloud Storage bucket\n\n1. In the Google Cloud console, go to the Cloud Storage **Buckets** page.\n\n [Go to Buckets](https://console.cloud.google.com/storage/browser)\n2. Click add_box **Create**.\n3. On the **Create a bucket** page, enter your bucket information. To go to the next step, click **Continue** .\n 1. For **Name your bucket**, enter a unique bucket name. Don't include sensitive information in the bucket name, because the bucket namespace is global and publicly visible.\n 2. In the **Choose where to store your data** section, do the following:\n 1. Select a [Location type](/storage/docs/locations).\n 2. Choose a location where your bucket's data is permanently stored from the **[Location type](/storage/docs/locations#available-locations)** drop-down menu.\n - If you select the [dual-region](/storage/docs/locations#location-dr) location type, you can also choose to enable [turbo replication](/storage/docs/availability-durability#turbo-replication) by using the relevant checkbox.\n 3. To set up [cross-bucket replication](/storage/docs/availability-durability#cross-bucket-replication), select **Add cross-bucket replication via Storage Transfer Service** and follow these steps: \n\n #### Set up cross-bucket replication\n\n 1. In the **Bucket** menu, select a bucket.\n 2. In the **Replication settings** section,\n click **Configure** to configure settings for the\n replication job.\n\n The **Configure cross-bucket replication** pane\n appears.\n - To filter objects to replicate by object name prefix, enter a prefix that you want to include or exclude objects from, then click add **Add a prefix**.\n - To set a storage class for the replicated objects, select a storage class from the **Storage class** menu. If you skip this step, the replicated objects will use the destination bucket's storage class by default.\n - Click **Done**.\n 3. In the **Choose how to store your data** section, do the following:\n 1. In the **Set a default class** section, select the following: **Standard**.\n 2. To enable [hierarchical namespace](/storage/docs/hns-overview), in the **Optimize storage for data-intensive workloads** section, select **Enable hierarchical namespace on this bucket** . **Note:** You cannot enable hierarchical namespace in existing buckets.\n 4. In the **Choose how to control access to objects** section, select whether or not your bucket enforces [public access prevention](/storage/docs/public-access-prevention), and select an [access control method](/storage/docs/access-control) for your bucket's objects. **Note:** You cannot change the **Prevent public access** setting if this setting is enforced at an [organization policy](/storage/docs/org-policy-constraints#public-access-prevention).\n 5. In the **Choose how to protect object data** section, do the following:\n - Select any of the options under **Data protection** that you want to set for your bucket.\n - To enable [soft delete](/storage/docs/soft-delete), click the **Soft delete policy (For data recovery)** checkbox, and specify the number of days you want to retain objects after deletion.\n - To set [Object Versioning](/storage/docs/object-versioning), click the **Object versioning (For version control)** checkbox, and specify the maximum number of versions per object and the number of days after which the noncurrent versions expire.\n - To enable the retention policy on objects and buckets, click the **Retention (For compliance)** checkbox, and then do the following:\n - To enable [Object Retention Lock](/storage/docs/object-lock), click the **Enable object retention** checkbox.\n - To enable [Bucket Lock](/storage/docs/bucket-lock), click the **Set bucket retention policy** checkbox, and choose a unit of time and a length of time for your retention period.\n - To choose how your object data will be encrypted, expand the **Data encryption** section (expand_more), and select a [**Data encryption** method](/storage/docs/encryption).\n4. Click **Create**.\n\n\u003cbr /\u003e\n\nMake a request to Cloud Vision\n------------------------------\n\n1. Save a local version of the sample image file ([`demo-img.jpg`](/static/vision/docs/images/demo-img.jpg)).\n\n2. In the Google Cloud console, go to the Cloud Storage **Buckets** page.\n\n [Go to Buckets](https://console.cloud.google.com/storage/browser)\n3. Select the bucket you created in the previous section.\n\n4. Click **Upload Files** and select the local version of the `demo-img.jpg`\n file to upload to your Cloud Storage bucket.\n\n This is the image file that you just uploaded: *Image credit* : [Rohiim Ariful](https://unsplash.com/photos/Iz2cMcT6BzU) on [Unsplash](https://unsplash.com/).\n\n \u003cbr /\u003e\n\n5. After the file is uploaded and appears in the Cloud Storage bucket,\n [share the image publicly](/storage/docs/access-control/making-data-public).\n\n6. In the [Try this method](#apis-explorer-try-this-method) section, complete\n the interactive API Explorer template by replacing\n `cloud-samples-data/vision` in the `image.source.imageUri` field with the\n name of the Cloud Storage bucket where you uploaded the `demo-img.jpg`\n file. The request body should look like the following:\n\n ```\n {\n \"requests\": [\n {\n \"features\": [\n {\n \"type\": \"LABEL_DETECTION\"\n }\n ],\n \"image\": {\n \"source\": {\n \"imageUri\": \"gs://cloud-samples-data/vision/demo-img.jpg\"\n }\n }\n }\n ]\n }\n ``` \n\n \u003cbr /\u003e\n\n7. Click **Execute** to send the request to the service. The JSON response\n appears after the request body.\n\nCongratulations! You've made your first `images.annotate` request to\nCloud Vision.\n\nClean up\n--------\n\nTo avoid unnecessary Google Cloud charges, use the Google Cloud console to\ndelete your Cloud Storage bucket (and your project) if you don't need them.\n\nWhat's next\n-----------\n\n- See a list of [all feature types](/vision/docs/features-list) and their uses.\n- Get started with the Vision API in your language of choice by using a [Vision API Client\n Library](/vision/docs/quickstart-client-libraries).\n- Use the [How-to guides](/vision/docs/how-to) to learn more about specific features, see example annotations, and get annotations for an individual file or image.\n- Learn about batch [image](/vision/docs/batch) and [file](/vision/docs/file-small-batch) (PDF/TIFF/GIF) annotation.\n- Browse through a comprehensive list of client library code [samples](/vision/docs/samples)."]]