airflow.providers.google.cloud.hooks.vision

此模組包含一個 Google Cloud Vision Hook。

屬性

ERR_DIFF_NAMES

ERR_UNABLE_TO_CREATE

NameDeterminer

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

CloudVisionHook

用於 Google Cloud Vision API 的 Hook。

模組內容

airflow.providers.google.cloud.hooks.vision.ERR_DIFF_NAMES = Multiline-String[source]
顯示值
"""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[source]
顯示值
"""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)[source]

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

label[source]
id_label[source]
get_path[source]
get_entity_with_name(entity, entity_id, location, project_id)[source]

檢查實體是否設定了 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)[source]

繼承自: airflow.providers.google.common.hooks.base_google.GoogleBaseHook

用於 Google Cloud Vision API 的 Hook。

Hook 中所有使用 project_id 的方法必須使用關鍵字引數呼叫,而不是位置引數。

product_name_determiner[source]
product_set_name_determiner[source]
get_conn()[source]

獲取 Cloud Vision 的連線。

返回:

Google Cloud Vision 客戶端物件。

返回型別:

google.cloud.vision_v1.ProductSearchClient

property annotator_client: google.cloud.vision_v1.ImageAnnotatorClient[source]

建立 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=())[source]

建立產品集。

有關文件,請參閱: CloudVisionCreateProductSetOperator

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

獲取產品集。

有關文件,請參閱: 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=())[source]

更新產品集。

有關文件,請參閱: CloudVisionUpdateProductSetOperator

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

刪除產品集。

有關文件,請參閱: CloudVisionDeleteProductSetOperator

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

建立產品。

有關文件,請參閱: CloudVisionCreateProductOperator

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

獲取產品。

有關文件,請參閱: CloudVisionGetProductOperator

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

更新產品。

有關文件,請參閱: CloudVisionUpdateProductOperator

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

刪除產品。

有關文件,請參閱: CloudVisionDeleteProductOperator

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

建立參考圖片。

有關文件,請參閱: CloudVisionCreateReferenceImageOperator

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

刪除參考圖片。

有關文件,請參閱: CloudVisionDeleteReferenceImageOperator

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

將產品新增到產品集。

有關文件,請參閱: CloudVisionAddProductToProductSetOperator

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

從產品集中移除產品。

有關文件,請參閱: CloudVisionRemoveProductFromProductSetOperator

annotate_image(request, retry=DEFAULT, timeout=None)[source]

對圖片進行標註。

有關文件,請參閱: CloudVisionImageAnnotateOperator

batch_annotate_images(requests, retry=DEFAULT, timeout=None)[source]

批次標註圖片。

有關文件,請參閱: CloudVisionImageAnnotateOperator

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

文字檢測。

有關文件,請參閱: CloudVisionDetectTextOperator

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

文件文字檢測。

有關文件,請參閱: CloudVisionTextDetectOperator

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

標籤檢測。

有關文件,請參閱: CloudVisionDetectImageLabelsOperator

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

安全搜尋檢測。

更多文件請參閱:CloudVisionDetectImageSafeSearchOperator

此條目是否有幫助?