| .. Licensed to the Apache Software Foundation (ASF) under one |
| or more contributor license agreements. See the NOTICE file |
| distributed with this work for additional information |
| regarding copyright ownership. The ASF licenses this file |
| to you under the Apache License, Version 2.0 (the |
| "License"); you may not use this file except in compliance |
| with the License. You may obtain a copy of the License at |
| |
| .. http://www.apache.org/licenses/LICENSE-2.0 |
| |
| .. Unless required by applicable law or agreed to in writing, |
| software distributed under the License is distributed on an |
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| KIND, either express or implied. See the License for the |
| specific language governing permissions and limitations |
| under the License. |
| |
| |
| |
| Google Cloud Vision Operators |
| ============================= |
| |
| Prerequisite Tasks |
| ------------------ |
| |
| .. include::/operators/_partials/prerequisite_tasks.rst |
| |
| .. _howto/operator:CloudVisionAddProductToProductSetOperator: |
| |
| CloudVisionAddProductToProductSetOperator |
| ----------------------------------------- |
| |
| Creates a new :code:`ReferenceImage` resource. |
| |
| For parameter definition, take a look at |
| :class:`~airflow.providers.google.cloud.operators.vision.CloudVisionAddProductToProductSetOperator` |
| |
| Using the operator |
| """""""""""""""""" |
| |
| We are using the :class:`~google.cloud.vision_v1.types.Product`, |
| :class:`~google.cloud.vision_v1.types.ProductSet` and :class:`~google.api_core.retry.Retry` objects from |
| Google libraries: |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :start-after: [START howto_operator_vision_retry_import] |
| :end-before: [END howto_operator_vision_retry_import] |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :start-after: [START howto_operator_vision_product_set_import] |
| :end-before: [END howto_operator_vision_product_set_import] |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :start-after: [START howto_operator_vision_product_import] |
| :end-before: [END howto_operator_vision_product_import] |
| |
| |
| If ``product_set_id`` and ``product_id`` was generated by the API it can be extracted from XCOM: |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :dedent: 4 |
| :start-after: [START howto_operator_vision_add_product_to_product_set] |
| :end-before: [END howto_operator_vision_add_product_to_product_set] |
| |
| Otherwise it can be specified explicitly: |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :dedent: 4 |
| :start-after: [START howto_operator_vision_add_product_to_product_set_2] |
| :end-before: [END howto_operator_vision_add_product_to_product_set_2] |
| |
| |
| Templating |
| """""""""" |
| |
| .. literalinclude:: /../../airflow/providers/google/cloud/operators/vision.py |
| :language: python |
| :dedent: 4 |
| :start-after: [START vision_add_product_to_product_set_template_fields] |
| :end-before: [END vision_add_product_to_product_set_template_fields] |
| |
| More information |
| """""""""""""""" |
| |
| See `Google Cloud Vision Add Product To Product Set documentation |
| <https://googleapis.github.io/google-cloud-python/latest/vision/gapic/v1/api.html#google.cloud.vision_v1.ProductSearchClient.add_product_to_product_set>`_. |
| |
| |
| .. _howto/operator:CloudVisionImageAnnotateOperator: |
| |
| CloudVisionImageAnnotateOperator |
| -------------------------------- |
| |
| Run image detection and annotation for an image. |
| |
| For parameter definition, take a look at |
| :class:`~airflow.providers.google.cloud.operators.vision.CloudVisionImageAnnotateOperator` |
| |
| Using the operator |
| """""""""""""""""" |
| |
| We are using the :class:`~google.cloud.vision.enums` and :class:`~google.api_core.retry.Retry` objects from |
| Google libraries: |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :start-after: [START howto_operator_vision_retry_import] |
| :end-before: [END howto_operator_vision_retry_import] |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :start-after: [START howto_operator_vision_enums_import] |
| :end-before: [END howto_operator_vision_enums_import] |
| |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :dedent: 4 |
| :start-after: [START howto_operator_vision_annotate_image] |
| :end-before: [END howto_operator_vision_annotate_image] |
| |
| The result can be extracted from XCOM: |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :dedent: 4 |
| :start-after: [START howto_operator_vision_annotate_image_result] |
| :end-before: [END howto_operator_vision_annotate_image_result] |
| |
| |
| Templating |
| """""""""" |
| |
| .. literalinclude:: /../../airflow/providers/google/cloud/operators/vision.py |
| :language: python |
| :dedent: 4 |
| :start-after: [START vision_annotate_image_template_fields] |
| :end-before: [END vision_annotate_image_template_fields] |
| |
| More information |
| """""""""""""""" |
| |
| See `Google Cloud Vision Annotate Image documentation |
| <https://googleapis.github.io/google-cloud-python/latest/vision/gapic/v1/api.html#google.cloud.vision_v1.ImageAnnotatorClient.annotate_image>`_. |
| |
| .. _howto/operator:CloudVisionCreateProductOperator: |
| |
| CloudVisionCreateProductOperator |
| -------------------------------- |
| |
| Creates and returns a new product resource. |
| |
| Possible errors regarding the :code:`Product` object provided: |
| |
| - Returns INVALID_ARGUMENT if ``display_name`` is missing or longer than 4096 characters. |
| - Returns INVALID_ARGUMENT if ``description`` is longer than 4096 characters. |
| - Returns INVALID_ARGUMENT if ``product_category`` is missing or invalid. |
| |
| For parameter definition, take a look at |
| :class:`~airflow.providers.google.cloud.operators.vision.CloudVisionCreateProductOperator` |
| |
| Using the operator |
| """""""""""""""""" |
| |
| We are using the ``Product`` and :class:`~google.api_core.retry.Retry` objects from Google libraries: |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :start-after: [START howto_operator_vision_product_import] |
| :end-before: [END howto_operator_vision_product_import] |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :start-after: [START howto_operator_vision_retry_import] |
| :end-before: [END howto_operator_vision_retry_import] |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :start-after: [START howto_operator_vision_product] |
| :end-before: [END howto_operator_vision_product] |
| |
| The ``product_id`` argument can be omitted (it will be generated by the API): |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :dedent: 4 |
| :start-after: [START howto_operator_vision_product_create] |
| :end-before: [END howto_operator_vision_product_create] |
| |
| Or it can be specified explicitly: |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :dedent: 4 |
| :start-after: [START howto_operator_vision_product_create_2] |
| :end-before: [END howto_operator_vision_product_create_2] |
| |
| |
| Templating |
| """""""""" |
| |
| .. literalinclude:: /../../airflow/providers/google/cloud/operators/vision.py |
| :language: python |
| :dedent: 4 |
| :start-after: [START vision_product_create_template_fields] |
| :end-before: [END vision_product_create_template_fields] |
| |
| More information |
| """""""""""""""" |
| |
| See `Google Cloud Vision Product create documentation |
| <https://googleapis.github.io/google-cloud-python/latest/vision/gapic/v1/api.html#google.cloud.vision_v1.ProductSearchClient.create_product>`_. |
| |
| .. _howto/operator:CloudVisionDeleteProductOperator: |
| |
| CloudVisionDeleteProductOperator |
| -------------------------------- |
| |
| Permanently deletes a product and its reference images. |
| |
| Metadata of the product and all its images will be deleted right away, but search queries |
| against :code:`ProductSets` containing the product may still work until all related |
| caches are refreshed. |
| |
| Possible errors: |
| |
| - Returns NOT_FOUND if the product does not exist. |
| |
| For parameter definition, take a look at |
| :class:`~airflow.providers.google.cloud.operators.vision.CloudVisionDeleteProductOperator` |
| |
| Using the operator |
| """""""""""""""""" |
| |
| If ``product_id`` was generated by the API it can be extracted from XCOM: |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :dedent: 4 |
| :start-after: [START howto_operator_vision_product_delete] |
| :end-before: [END howto_operator_vision_product_delete] |
| |
| Otherwise it can be specified explicitly: |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :dedent: 4 |
| :start-after: [START howto_operator_vision_product_delete_2] |
| :end-before: [END howto_operator_vision_product_delete_2] |
| |
| Templating |
| """""""""" |
| |
| .. literalinclude:: /../../airflow/providers/google/cloud/operators/vision.py |
| :language: python |
| :dedent: 4 |
| :start-after: [START vision_product_delete_template_fields] |
| :end-before: [END vision_product_delete_template_fields] |
| |
| More information |
| """""""""""""""" |
| |
| See `Google Cloud Vision Product delete documentation |
| <https://googleapis.github.io/google-cloud-python/latest/vision/gapic/v1/api.html#google.cloud.vision_v1.ProductSearchClient.delete_product>`_. |
| |
| .. _howto/operator:CloudVisionGetProductOperator: |
| |
| CloudVisionGetProductOperator |
| ----------------------------- |
| |
| Gets information associated with a :code:`Product`. |
| |
| Possible errors: |
| |
| - Returns NOT_FOUND if the ``Product`` does not exist. |
| |
| For parameter definition, take a look at |
| :class:`~airflow.providers.google.cloud.operators.vision.CloudVisionGetProductOperator` |
| |
| Using the operator |
| """""""""""""""""" |
| |
| If ``product_id`` was generated by the API it can be extracted from XCOM: |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :dedent: 4 |
| :start-after: [START howto_operator_vision_product_get] |
| :end-before: [END howto_operator_vision_product_get] |
| |
| Otherwise it can be specified explicitly: |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :dedent: 4 |
| :start-after: [START howto_operator_vision_product_get_2] |
| :end-before: [END howto_operator_vision_product_get_2] |
| |
| Templating |
| """""""""" |
| |
| .. literalinclude:: /../../airflow/providers/google/cloud/operators/vision.py |
| :language: python |
| :dedent: 4 |
| :start-after: [START vision_product_get_template_fields] |
| :end-before: [END vision_product_get_template_fields] |
| |
| More information |
| """""""""""""""" |
| |
| See `Google Cloud Vision Product get documentation |
| <https://googleapis.github.io/google-cloud-python/latest/vision/gapic/v1/api.html#google.cloud.vision_v1.ProductSearchClient.get_product>`_. |
| |
| .. _howto/operator:CloudVisionCreateProductSetOperator: |
| |
| CloudVisionProductSetCreateOperator |
| ----------------------------------- |
| |
| Creates a new :code:`ProductSet` resource. |
| |
| For parameter definition, take a look at |
| :class:`~airflow.providers.google.cloud.operators.vision.CloudVisionCreateProductSetOperator` |
| |
| Using the operator |
| """""""""""""""""" |
| |
| We are using the ``ProductSet`` and :class:`~google.api_core.retry.Retry` objects from Google libraries: |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :start-after: [START howto_operator_vision_product_set_import] |
| :end-before: [END howto_operator_vision_product_set_import] |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :start-after: [START howto_operator_vision_retry_import] |
| :end-before: [END howto_operator_vision_retry_import] |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :start-after: [START howto_operator_vision_product_set] |
| :end-before: [END howto_operator_vision_product_set] |
| |
| The ``product_set_id`` argument can be omitted (it will be generated by the API): |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :dedent: 4 |
| :start-after: [START howto_operator_vision_product_set_create] |
| :end-before: [END howto_operator_vision_product_set_create] |
| |
| Or it can be specified explicitly: |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :dedent: 4 |
| :start-after: [START howto_operator_vision_product_set_create_2] |
| :end-before: [END howto_operator_vision_product_set_create_2] |
| |
| |
| Templating |
| """""""""" |
| |
| .. literalinclude:: /../../airflow/providers/google/cloud/operators/vision.py |
| :language: python |
| :dedent: 4 |
| :start-after: [START vision_productset_create_template_fields] |
| :end-before: [END vision_productset_create_template_fields] |
| |
| More information |
| """""""""""""""" |
| |
| See `Google Cloud Vision ProductSet create documentation |
| <https://googleapis.github.io/google-cloud-python/latest/vision/gapic/v1/api.html#google.cloud.vision_v1.ProductSearchClient.create_product_set>`_. |
| |
| .. _howto/operator:CloudVisionDeleteProductSetOperator: |
| |
| CloudVisionDeleteProductSetOperator |
| ----------------------------------- |
| |
| Permanently deletes a :code:`ProductSet`. :code:`Products` and :code:`ReferenceImages` in |
| the :code:`ProductSet` are not deleted. The actual image files are not deleted from |
| Google Cloud Storage. |
| |
| For parameter definition, take a look at |
| :class:`~airflow.providers.google.cloud.operators.vision.CloudVisionDeleteProductSetOperator` |
| |
| Using the operator |
| """""""""""""""""" |
| |
| If ``product_set_id`` was generated by the API it can be extracted from XCOM: |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :dedent: 4 |
| :start-after: [START howto_operator_vision_product_set_delete] |
| :end-before: [END howto_operator_vision_product_set_delete] |
| |
| Otherwise it can be specified explicitly: |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :dedent: 4 |
| :start-after: [START howto_operator_vision_product_set_delete_2] |
| :end-before: [END howto_operator_vision_product_set_delete_2] |
| |
| Templating |
| """""""""" |
| |
| .. literalinclude:: /../../airflow/providers/google/cloud/operators/vision.py |
| :language: python |
| :dedent: 4 |
| :start-after: [START vision_productset_delete_template_fields] |
| :end-before: [END vision_productset_delete_template_fields] |
| |
| More information |
| """""""""""""""" |
| |
| See `Google Cloud Vision ProductSet delete documentation |
| <https://googleapis.github.io/google-cloud-python/latest/vision/gapic/v1/api.html#google.cloud.vision_v1.ProductSearchClient.delete_product_set>`_. |
| |
| .. _howto/operator:CloudVisionGetProductSetOperator: |
| |
| CloudVisionGetProductSetOperator |
| -------------------------------- |
| |
| Gets information associated with a :code:`ProductSet`. |
| |
| For parameter definition, take a look at |
| :class:`~airflow.providers.google.cloud.operators.vision.CloudVisionGetProductSetOperator` |
| |
| Using the operator |
| """""""""""""""""" |
| |
| If ``product_set_id`` was generated by the API it can be extracted from XCOM: |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :dedent: 4 |
| :start-after: [START howto_operator_vision_product_set_get] |
| :end-before: [END howto_operator_vision_product_set_get] |
| |
| Otherwise it can be specified explicitly: |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :dedent: 4 |
| :start-after: [START howto_operator_vision_product_set_get_2] |
| :end-before: [END howto_operator_vision_product_set_get_2] |
| |
| Templating |
| """""""""" |
| |
| .. literalinclude:: /../../airflow/providers/google/cloud/operators/vision.py |
| :language: python |
| :dedent: 4 |
| :start-after: [START vision_productset_get_template_fields] |
| :end-before: [END vision_productset_get_template_fields] |
| |
| More information |
| """""""""""""""" |
| |
| See `Google Cloud Vision ProductSet get documentation |
| <https://googleapis.github.io/google-cloud-python/latest/vision/gapic/v1/api.html#google.cloud.vision_v1.ProductSearchClient.get_product_set>`_. |
| |
| .. _howto/operator:CloudVisionUpdateProductSetOperator: |
| |
| CloudVisionUpdateProductSetOperator |
| ----------------------------------- |
| |
| Makes changes to a :code:`ProductSet` resource. Only :code:`display_name` can be updated |
| currently. |
| |
| .. note:: To locate the ``ProductSet`` resource, its ``name`` in the form |
| ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` is necessary. |
| |
| You can provide the ``name`` directly as an attribute of the ``product_set`` object. |
| However, you can leave it blank and provide ``location`` and ``product_set_id`` instead (and |
| optionally ``project_id`` - if not present, the connection default will be used) and the |
| ``name`` will be created by the operator itself. |
| |
| This mechanism exists for your convenience, to allow leaving the ``project_id`` empty and |
| having Airflow use the connection default ``project_id``. |
| |
| For parameter definition, take a look at |
| :class:`~airflow.providers.google.cloud.operators.vision.CloudVisionUpdateProductSetOperator` |
| |
| Using the operator |
| """""""""""""""""" |
| |
| We are using the ``ProductSet`` object from the Google Cloud Vision library: |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :start-after: [START howto_operator_vision_product_set_import] |
| :end-before: [END howto_operator_vision_product_set_import] |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :start-after: [START howto_operator_vision_product_set] |
| :end-before: [END howto_operator_vision_product_set] |
| |
| Initialization of the task: |
| |
| If ``product_set_id`` was generated by the API it can be extracted from XCOM: |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :dedent: 4 |
| :start-after: [START howto_operator_vision_product_set_update] |
| :end-before: [END howto_operator_vision_product_set_update] |
| |
| Otherwise it can be specified explicitly: |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :dedent: 4 |
| :start-after: [START howto_operator_vision_product_set_update_2] |
| :end-before: [END howto_operator_vision_product_set_update_2] |
| |
| Templating |
| """""""""" |
| |
| .. literalinclude:: /../../airflow/providers/google/cloud/operators/vision.py |
| :language: python |
| :dedent: 4 |
| :start-after: [START vision_productset_update_template_fields] |
| :end-before: [END vision_productset_update_template_fields] |
| |
| More information |
| """""""""""""""" |
| |
| See `Google Cloud Vision ProductSet update documentation |
| <https://googleapis.github.io/google-cloud-python/latest/vision/gapic/v1/api.html#google.cloud.vision_v1.ProductSearchClient.update_product_set>`_. |
| |
| .. _howto/operator:CloudVisionUpdateProductOperator: |
| |
| CloudVisionUpdateProductOperator |
| -------------------------------- |
| |
| Makes changes to a :code:`Product` resource. Only the :code:`display_name`, |
| :code:`description`, and :code:`labels` fields can be updated right now. |
| If labels are updated, the change will not be reflected in queries until the next index |
| time. |
| |
| .. note:: To locate the ``Product`` resource, its ``name`` in the form |
| ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` is necessary. |
| |
| You can provide the ``name`` directly as an attribute of the ``product`` object. However, you |
| can leave it blank and provide ``location`` and ``product_id`` instead (and optionally |
| ``project_id`` - if not present, the connection default will be used) and the ``name`` will |
| be created by the operator itself. |
| |
| This mechanism exists for your convenience, to allow leaving the ``project_id`` empty and |
| having Airflow use the connection default ``project_id``. |
| |
| Possible errors: |
| |
| - Returns NOT_FOUND if the ``Product`` does not exist. |
| - Returns INVALID_ARGUMENT if ``display_name`` is present in ``update_mask`` but is missing |
| from the request or longer than 4096 characters. |
| - Returns INVALID_ARGUMENT if ``description`` is present in ``update_mask`` but is longer than |
| 4096 characters. |
| - Returns INVALID_ARGUMENT if ``product_category`` is present in ``update_mask``. |
| |
| For parameter definition, take a look at |
| :class:`~airflow.providers.google.cloud.operators.vision.CloudVisionUpdateProductOperator` |
| |
| Using the operator |
| """""""""""""""""" |
| |
| We are using the ``Product`` object from the Google Cloud Vision library: |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :start-after: [START howto_operator_vision_product_import] |
| :end-before: [END howto_operator_vision_product_import] |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :start-after: [START howto_operator_vision_product] |
| :end-before: [END howto_operator_vision_product] |
| |
| If ``product_id`` was generated by the API it can be extracted from XCOM: |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :dedent: 4 |
| :start-after: [START howto_operator_vision_product_update] |
| :end-before: [END howto_operator_vision_product_update] |
| |
| Otherwise it can be specified explicitly: |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :dedent: 4 |
| :start-after: [START howto_operator_vision_product_update_2] |
| :end-before: [END howto_operator_vision_product_update_2] |
| |
| Templating |
| """""""""" |
| |
| .. literalinclude:: /../../airflow/providers/google/cloud/operators/vision.py |
| :language: python |
| :dedent: 4 |
| :start-after: [START vision_product_update_template_fields] |
| :end-before: [END vision_product_update_template_fields] |
| |
| More information |
| """""""""""""""" |
| |
| See `Google Cloud Vision Product update documentation |
| <https://googleapis.github.io/google-cloud-python/latest/vision/gapic/v1/api.html#google.cloud.vision_v1.ProductSearchClient.update_product>`_. |
| |
| .. _howto/operator:CloudVisionCreateReferenceImageOperator: |
| |
| CloudVisionCreateReferenceImageOperator |
| --------------------------------------- |
| |
| Creates a new :code:`ReferenceImage` resource. |
| |
| For parameter definition, take a look at |
| :class:`~airflow.providers.google.cloud.operators.vision.CloudVisionCreateReferenceImageOperator` |
| |
| Using the operator |
| """""""""""""""""" |
| |
| We are using the :class:`~google.cloud.vision_v1.types.ReferenceImage` and :class:`~google.api_core.retry.Retry` objects from Google libraries: |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :start-after: [START howto_operator_vision_reference_image_import] |
| :end-before: [END howto_operator_vision_reference_image_import] |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :start-after: [START howto_operator_vision_retry_import] |
| :end-before: [END howto_operator_vision_retry_import] |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :start-after: [START howto_operator_vision_reference_image] |
| :end-before: [END howto_operator_vision_reference_image] |
| |
| The ``product_set_id`` argument can be omitted (it will be generated by the API): |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :dedent: 4 |
| :start-after: [START howto_operator_vision_reference_image_create] |
| :end-before: [END howto_operator_vision_reference_image_create] |
| |
| Or it can be specified explicitly: |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :dedent: 4 |
| :start-after: [START howto_operator_vision_reference_image_create_2] |
| :end-before: [END howto_operator_vision_reference_image_create_2] |
| |
| |
| Templating |
| """""""""" |
| |
| .. literalinclude:: /../../airflow/providers/google/cloud/operators/vision.py |
| :language: python |
| :dedent: 4 |
| :start-after: [START vision_reference_image_create_template_fields] |
| :end-before: [END vision_reference_image_create_template_fields] |
| |
| More information |
| """""""""""""""" |
| |
| See `Google Cloud Vision ReferenceImage delete documentation |
| <https://googleapis.github.io/google-cloud-python/latest/vision/gapic/v1/api.html#google.cloud.vision_v1.ProductSearchClient.create_reference_image>`_. |
| |
| .. _howto/operator:CloudVisionDeleteReferenceImageOperator: |
| |
| CloudVisionDeleteReferenceImageOperator |
| --------------------------------------- |
| |
| Deletes a :code:`ReferenceImage` resource. |
| |
| For parameter definition, take a look at |
| :class:`~airflow.providers.google.cloud.operators.vision.CloudVisionDeleteReferenceImageOperator` |
| |
| Using the operator |
| """""""""""""""""" |
| |
| We are using the :class:`~google.cloud.vision_v1.types.ReferenceImage` and :class:`~google.api_core.retry.Retry` objects from Google libraries: |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :start-after: [START howto_operator_vision_reference_image_import] |
| :end-before: [END howto_operator_vision_reference_image_import] |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :start-after: [START howto_operator_vision_retry_import] |
| :end-before: [END howto_operator_vision_retry_import] |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :start-after: [START howto_operator_vision_reference_image] |
| :end-before: [END howto_operator_vision_reference_image] |
| |
| The ``product_set_id`` argument can be omitted (it will be generated by the API): |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :dedent: 4 |
| :start-after: [START howto_operator_vision_reference_image_delete] |
| :end-before: [END howto_operator_vision_reference_image_delete] |
| |
| Or it can be specified explicitly: |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :dedent: 4 |
| :start-after: [START howto_operator_vision_reference_image_delete_2] |
| :end-before: [END howto_operator_vision_reference_image_delete_2] |
| |
| |
| Templating |
| """""""""" |
| |
| .. literalinclude:: /../../airflow/providers/google/cloud/operators/vision.py |
| :language: python |
| :dedent: 4 |
| :start-after: [START vision_reference_image_create_template_fields] |
| :end-before: [END vision_reference_image_create_template_fields] |
| |
| More information |
| """""""""""""""" |
| |
| See `Google Cloud Vision ReferenceImage create documentation |
| <https://googleapis.github.io/google-cloud-python/latest/vision/gapic/v1/api.html#google.cloud.vision_v1.ProductSearchClient.delete_reference_image>`_. |
| |
| .. _howto/operator:CloudVisionRemoveProductFromProductSetOperator: |
| |
| CloudVisionRemoveProductFromProductSetOperator |
| ---------------------------------------------- |
| |
| Creates a new :code:`ReferenceImage` resource. |
| |
| For parameter definition, take a look at |
| :class:`~airflow.providers.google.cloud.operators.vision.CloudVisionRemoveProductFromProductSetOperator` |
| |
| Using the operator |
| """""""""""""""""" |
| |
| We are using the :class:`~google.cloud.vision_v1.types.Product`, |
| :class:`~google.cloud.vision_v1.types.ProductSet` and :class:`~google.api_core.retry.Retry` objects from |
| Google libraries: |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :start-after: [START howto_operator_vision_retry_import] |
| :end-before: [END howto_operator_vision_retry_import] |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :start-after: [START howto_operator_vision_product_set_import] |
| :end-before: [END howto_operator_vision_product_set_import] |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :start-after: [START howto_operator_vision_product_import] |
| :end-before: [END howto_operator_vision_product_import] |
| |
| |
| If ``product_set_id`` and ``product_id`` was generated by the API it can be extracted from XCOM: |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :dedent: 4 |
| :start-after: [START howto_operator_vision_remove_product_from_product_set] |
| :end-before: [END howto_operator_vision_remove_product_from_product_set] |
| |
| Otherwise it can be specified explicitly: |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :dedent: 4 |
| :start-after: [START howto_operator_vision_remove_product_from_product_set_2] |
| :end-before: [END howto_operator_vision_remove_product_from_product_set_2] |
| |
| |
| Templating |
| """""""""" |
| |
| .. literalinclude:: /../../airflow/providers/google/cloud/operators/vision.py |
| :language: python |
| :dedent: 4 |
| :start-after: [START vision_remove_product_from_product_set_template_fields] |
| :end-before: [END vision_remove_product_from_product_set_template_fields] |
| |
| More information |
| """""""""""""""" |
| |
| See `Google Cloud Vision Remove Product From Product Set documentation |
| <https://googleapis.github.io/google-cloud-python/latest/vision/gapic/v1/api.html#google.cloud.vision_v1.ProductSearchClient.remove_product_from_product_set>`_. |
| |
| |
| .. _howto/operator:CloudVisionDetectTextOperator: |
| |
| CloudVisionDetectTextOperator |
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| |
| Run text detection for an image. |
| |
| For parameter definition, take a look at |
| :class:`~airflow.providers.google.cloud.operators.vision.CloudVisionDetectTextOperator` |
| |
| |
| Using the operator |
| """""""""""""""""" |
| |
| We are using the :class:`~google.api_core.retry.Retry` objects from |
| Google libraries: |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :start-after: [START howto_operator_vision_retry_import] |
| :end-before: [END howto_operator_vision_retry_import] |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :dedent: 4 |
| :start-after: [START howto_operator_vision_detect_text] |
| :end-before: [END howto_operator_vision_detect_text] |
| |
| The result can be extracted from XCOM: |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :dedent: 4 |
| :start-after: [START howto_operator_vision_detect_text_result] |
| :end-before: [END howto_operator_vision_detect_text_result] |
| |
| |
| Templating |
| """""""""" |
| |
| .. literalinclude:: /../../airflow/providers/google/cloud/operators/vision.py |
| :language: python |
| :dedent: 4 |
| :start-after: [START vision_detect_text_set_template_fields] |
| :end-before: [END vision_detect_text_set_template_fields] |
| |
| More information |
| """""""""""""""" |
| |
| See `Google Cloud Vision Text Detection documentation |
| <https://googleapis.github.io/google-cloud-python/latest/vision/gapic/v1/api.html#google.cloud.vision_v1.ImageAnnotatorClient.text_detection>`_. |
| |
| .. _howto/operator:CloudVisionTextDetectOperator: |
| |
| CloudVisionTextDetectOperator |
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| |
| Run document text detection for an image. |
| |
| For parameter definition, take a look at |
| :class:`~airflow.providers.google.cloud.operators.vision.CloudVisionTextDetectOperator` |
| |
| |
| Using the operator |
| """""""""""""""""" |
| |
| We are using the :class:`~google.api_core.retry.Retry` objects from |
| Google libraries: |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :start-after: [START howto_operator_vision_retry_import] |
| :end-before: [END howto_operator_vision_retry_import] |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :dedent: 4 |
| :start-after: [START howto_operator_vision_document_detect_text] |
| :end-before: [END howto_operator_vision_document_detect_text] |
| |
| The result can be extracted from XCOM: |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :dedent: 4 |
| :start-after: [START howto_operator_vision_document_detect_text_result] |
| :end-before: [END howto_operator_vision_document_detect_text_result] |
| |
| |
| Templating |
| """""""""" |
| |
| .. literalinclude:: /../../airflow/providers/google/cloud/operators/vision.py |
| :language: python |
| :dedent: 4 |
| :start-after: [START vision_document_detect_text_set_template_fields] |
| :end-before: [END vision_document_detect_text_set_template_fields] |
| |
| More information |
| """""""""""""""" |
| |
| See `Google Cloud Vision Document Text Detection documentation |
| <https://googleapis.github.io/google-cloud-python/latest/vision/gapic/v1/api.html#google.cloud.vision_v1.ImageAnnotatorClient.document_text_detection>`_. |
| |
| .. _howto/operator:CloudVisionDetectImageLabelsOperator: |
| |
| CloudVisionDetectImageLabelsOperator |
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| |
| Run image label detection for an image. |
| |
| For parameter definition, take a look at |
| :class:`~airflow.providers.google.cloud.operators.vision.CloudVisionDetectImageLabelsOperator` |
| |
| |
| |
| Using the operator |
| """""""""""""""""" |
| |
| We are using the :class:`~google.api_core.retry.Retry` objects from |
| Google libraries: |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :start-after: [START howto_operator_vision_retry_import] |
| :end-before: [END howto_operator_vision_retry_import] |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :dedent: 4 |
| :start-after: [START howto_operator_vision_detect_labels] |
| :end-before: [END howto_operator_vision_detect_labels] |
| |
| The result can be extracted from XCOM: |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :dedent: 4 |
| :start-after: [START howto_operator_vision_detect_labels_result] |
| :end-before: [END howto_operator_vision_detect_labels_result] |
| |
| |
| Templating |
| """""""""" |
| |
| .. literalinclude:: /../../airflow/providers/google/cloud/operators/vision.py |
| :language: python |
| :dedent: 4 |
| :start-after: [START vision_detect_labels_template_fields] |
| :end-before: [END vision_detect_labels_template_fields] |
| |
| More information |
| """""""""""""""" |
| |
| See `Google Cloud Vision Label Detection documentation |
| <https://googleapis.github.io/google-cloud-python/latest/vision/gapic/v1/api.html#google.cloud.vision_v1.ImageAnnotatorClient.label_detection>`_. |
| |
| .. _howto/operator:CloudVisionDetectImageSafeSearchOperator: |
| |
| CloudVisionDetectImageSafeSearchOperator |
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| |
| Run image label detection for an image. |
| |
| For parameter definition, take a look at |
| :class:`~airflow.providers.google.cloud.operators.vision.CloudVisionDetectImageSafeSearchOperator` |
| |
| |
| Using the operator |
| """""""""""""""""" |
| |
| We are using the :class:`~google.api_core.retry.Retry` objects from |
| Google libraries: |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :start-after: [START howto_operator_vision_retry_import] |
| :end-before: [END howto_operator_vision_retry_import] |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :dedent: 4 |
| :start-after: [START howto_operator_vision_detect_safe_search] |
| :end-before: [END howto_operator_vision_detect_safe_search] |
| |
| The result can be extracted from XCOM: |
| |
| .. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_vision.py |
| :language: python |
| :dedent: 4 |
| :start-after: [START howto_operator_vision_detect_safe_search_result] |
| :end-before: [END howto_operator_vision_detect_safe_search_result] |
| |
| |
| Templating |
| """""""""" |
| |
| .. literalinclude:: /../../airflow/providers/google/cloud/operators/vision.py |
| :language: python |
| :dedent: 4 |
| :start-after: [START vision_detect_safe_search_template_fields] |
| :end-before: [END vision_detect_safe_search_template_fields] |
| |
| More information |
| """""""""""""""" |
| |
| See `Google Cloud Vision Safe Search Detection documentation |
| <https://googleapis.github.io/google-cloud-python/latest/vision/gapic/v1/api.html#google.cloud.vision_v1.ImageAnnotatorClient.safe_search_detection>`_. |
| |
| Reference |
| --------- |
| |
| For further information, look at: |
| |
| * `Client Library Documentation <https://googleapis.github.io/google-cloud-python/latest/vision/index.html>`__ |
| * `Product Documentation <https://cloud.google.com/vision/docs/>`__ |