コード例 #1
0
 def execute(self, context):
     hook = CloudVideoIntelligenceHook(gcp_conn_id=self.gcp_conn_id)
     operation = hook.annotate_video(
         input_uri=self.input_uri,
         input_content=self.input_content,
         video_context=self.video_context,
         location=self.location,
         retry=self.retry,
         features=[enums.Feature.LABEL_DETECTION],
     )
     self.log.info("Processing video for label annotations")
     result = MessageToDict(operation.result())
     self.log.info("Finished processing.")
     return result
コード例 #2
0
 def setUp(self):
     with mock.patch(
         "airflow.gcp.hooks.video_intelligence.CloudVideoIntelligenceHook.__init__",
         new=mock_base_gcp_hook_default_project_id,
     ):
         self.hook = CloudVideoIntelligenceHook(gcp_conn_id="test")