airflow.providers.google.cloud.hooks.vision

此模組包含 Google Cloud Vision Hook。

模組內容

類別

NameDeterminer

用於決定實體名稱的輔助類別。

CloudVisionHook

Google Cloud Vision API 的 Hook。

屬性

ERR_DIFF_NAMES

ERR_UNABLE_TO_CREATE

airflow.providers.google.cloud.hooks.vision.ERR_DIFF_NAMES = Multiline-String[原始碼]
顯示值
"""The {label} name provided in the object ({explicit_name}) is different
    than the name created from the input parameters ({constructed_name}). Please either:
    1) Remove the {label} name,
    2) Remove the location and {id_label} parameters,
    3) Unify the {label} name and input parameters.
    """
airflow.providers.google.cloud.hooks.vision.ERR_UNABLE_TO_CREATE = Multiline-String[原始碼]
顯示值
"""Unable to determine the {label} name. Please either set the name directly
    in the {label} object or provide the `location` and `{id_label}` parameters.
    """
class airflow.providers.google.cloud.hooks.vision.NameDeterminer(label, id_label, get_path)[原始碼]

用於決定實體名稱的輔助類別。

get_entity_with_name(entity, entity_id, location, project_id)[原始碼]

檢查實體是否已設定 name 屬性。

  • 若是,則不採取任何動作。

  • 若否,且名稱可以從提供的其他參數建構,則會建立名稱並填入

    實體中。

  • 若實體的 ‘name’ 屬性已設定,且名稱可以從提供的其他參數建構:

    * 若兩者相同 - 不採取任何動作 * 若兩者不同 - 則會拋出例外。

參數
  • entity (Any) – 實體

  • entity_id (str | None) – 實體 ID

  • location (str | None) – 位置

  • project_id (str) – Google Cloud Vision 專案的 ID。

返回

相同的實體或具有新名稱的實體

引發

AirflowException

返回類型

Any

class airflow.providers.google.cloud.hooks.vision.CloudVisionHook(gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[原始碼]

基底類別: airflow.providers.google.common.hooks.base_google.GoogleBaseHook

Google Cloud Vision API 的 Hook。

hook 中使用 project_id 的所有方法都必須使用關鍵字引數而非位置引數呼叫。

product_name_determiner[原始碼]
product_set_name_determiner[原始碼]
get_conn()[原始碼]

擷取 Cloud Vision 的連線。

返回

Google Cloud Vision 用戶端物件。

返回類型

google.cloud.vision_v1.ProductSearchClient

annotator_client()[原始碼]

建立 ImageAnnotatorClient。

返回

Google Image Annotator 用戶端物件。

返回類型

google.cloud.vision_v1.ImageAnnotatorClient

create_product_set(location, product_set, project_id=PROVIDE_PROJECT_ID, product_set_id=None, retry=DEFAULT, timeout=None, metadata=())[原始碼]

建立產品集。

如需文件,請參閱: CloudVisionCreateProductSetOperator

get_product_set(location, product_set_id, project_id=PROVIDE_PROJECT_ID, retry=DEFAULT, timeout=None, metadata=())[原始碼]

取得產品集。

如需文件,請參閱: CloudVisionGetProductSetOperator

update_product_set(product_set, project_id=PROVIDE_PROJECT_ID, location=None, product_set_id=None, update_mask=None, retry=DEFAULT, timeout=None, metadata=())[原始碼]

更新產品集。

如需文件,請參閱: CloudVisionUpdateProductSetOperator

delete_product_set(location, product_set_id, project_id=PROVIDE_PROJECT_ID, retry=DEFAULT, timeout=None, metadata=())[原始碼]

刪除產品集。

如需文件,請參閱: CloudVisionDeleteProductSetOperator

create_product(location, product, project_id=PROVIDE_PROJECT_ID, product_id=None, retry=DEFAULT, timeout=None, metadata=())[原始碼]

建立產品。

如需文件,請參閱: CloudVisionCreateProductOperator

get_product(location, product_id, project_id=PROVIDE_PROJECT_ID, retry=DEFAULT, timeout=None, metadata=())[原始碼]

取得產品。

如需文件,請參閱: CloudVisionGetProductOperator

update_product(product, project_id=PROVIDE_PROJECT_ID, location=None, product_id=None, update_mask=None, retry=DEFAULT, timeout=None, metadata=())[原始碼]

更新產品。

如需文件,請參閱: CloudVisionUpdateProductOperator

delete_product(location, product_id, project_id=PROVIDE_PROJECT_ID, retry=DEFAULT, timeout=None, metadata=())[原始碼]

刪除產品。

如需文件,請參閱: CloudVisionDeleteProductOperator

create_reference_image(location, product_id, reference_image, project_id, reference_image_id=None, retry=DEFAULT, timeout=None, metadata=())[原始碼]

建立參考圖片。

如需文件,請參閱: CloudVisionCreateReferenceImageOperator

delete_reference_image(location, product_id, reference_image_id, project_id, retry=DEFAULT, timeout=None, metadata=())[原始碼]

刪除參考圖片。

如需文件,請參閱: CloudVisionDeleteReferenceImageOperator

add_product_to_product_set(product_set_id, product_id, project_id, location, retry=DEFAULT, timeout=None, metadata=())[原始碼]

將產品新增至產品集。

如需文件,請參閱: CloudVisionAddProductToProductSetOperator

remove_product_from_product_set(product_set_id, product_id, project_id, location, retry=DEFAULT, timeout=None, metadata=())[原始碼]

從產品集中移除產品。

如需文件,請參閱: CloudVisionRemoveProductFromProductSetOperator

annotate_image(request, retry=DEFAULT, timeout=None)[原始碼]

標註圖片。

如需文件,請參閱: CloudVisionImageAnnotateOperator

batch_annotate_images(requests, retry=DEFAULT, timeout=None)[原始碼]

批次標註圖片。

如需文件,請參閱: CloudVisionImageAnnotateOperator

text_detection(image, max_results=None, retry=DEFAULT, timeout=None, additional_properties=None)[原始碼]

文字偵測。

如需文件,請參閱: CloudVisionDetectTextOperator

document_text_detection(image, max_results=None, retry=DEFAULT, timeout=None, additional_properties=None)[原始碼]

文件文字偵測。

如需文件,請參閱: CloudVisionTextDetectOperator

label_detection(image, max_results=None, retry=DEFAULT, timeout=None, additional_properties=None)[原始碼]

標籤偵測。

文件請參閱: CloudVisionDetectImageLabelsOperator

safe_search_detection(image, max_results=None, retry=DEFAULT, timeout=None, additional_properties=None)[source]

安全搜尋偵測。

文件請參閱: CloudVisionDetectImageSafeSearchOperator

這篇文章對您有幫助嗎?