3333
3434
3535def analyze_explicit_content (path ):
36+ # [START video_analyze_explicit_content]
3637 """ Detects explicit content from the GCS path to a video. """
3738 video_client = videointelligence .VideoIntelligenceServiceClient ()
3839 features = [videointelligence .enums .Feature .EXPLICIT_CONTENT_DETECTION ]
@@ -52,9 +53,11 @@ def analyze_explicit_content(path):
5253 print ('Time: {}s' .format (frame_time ))
5354 print ('\t pornography: {}' .format (
5455 likely_string [frame .pornography_likelihood ]))
56+ # [END video_analyze_explicit_content]
5557
5658
5759def analyze_labels (path ):
60+ # [START video_analyze_labels_gcs]
5861 """ Detects labels given a GCS path. """
5962 video_client = videointelligence .VideoIntelligenceServiceClient ()
6063 features = [videointelligence .enums .Feature .LABEL_DETECTION ]
@@ -129,9 +132,11 @@ def analyze_labels(path):
129132 print ('\t First frame time offset: {}s' .format (time_offset ))
130133 print ('\t First frame confidence: {}' .format (frame .confidence ))
131134 print ('\n ' )
135+ # [END video_analyze_labels_gcs]
132136
133137
134138def analyze_labels_file (path ):
139+ # [START video_analyze_labels_local]
135140 """Detect labels given a file path."""
136141 video_client = videointelligence .VideoIntelligenceServiceClient ()
137142 features = [videointelligence .enums .Feature .LABEL_DETECTION ]
@@ -202,9 +207,11 @@ def analyze_labels_file(path):
202207 print ('\t First frame time offset: {}s' .format (time_offset ))
203208 print ('\t First frame confidence: {}' .format (frame .confidence ))
204209 print ('\n ' )
210+ # [END video_analyze_labels_local]
205211
206212
207213def analyze_shots (path ):
214+ # [START video_analyze_shots]
208215 """ Detects camera shot changes. """
209216 video_client = videointelligence .VideoIntelligenceServiceClient ()
210217 features = [videointelligence .enums .Feature .SHOT_CHANGE_DETECTION ]
@@ -221,6 +228,7 @@ def analyze_shots(path):
221228 end_time = (shot .end_time_offset .seconds +
222229 shot .end_time_offset .nanos / 1e9 )
223230 print ('\t Shot {}: {} to {}' .format (i , start_time , end_time ))
231+ # [END video_analyze_shots]
224232
225233
226234if __name__ == '__main__' :
0 commit comments