Я настроил функцию Google Cloud, которая берет видео, загруженное из переднего движка приложения, помещает его в облачное хранилище Google, а затем применяет API-интерфейс для видеонаблюдения Google cloud. Результаты API отображаются в консоли. Я хочу, чтобы эти результаты были помещены в json-файл в облачном хранилище Google, чтобы я мог получить к ним доступ через большой запрос.
Я выделил методу out_put_uri переменную относительно того, где должен находиться файл json, однако я не уверен, как вызывать этот метод.
импорт ОС
из google.cloud импорт видеоинтеллекта
def video_dump (событие, контекст):
""" Detects camera shot changes. """
# [START video_shot_tutorial_construct_request]
video_client = videointelligence.VideoIntelligenceServiceClient()
features = [videointelligence.enums.Feature.SHOT_CHANGE_DETECTION]
operation = video_client.annotate_video('gs://'+event['bucket']+'/'+event['name'], features=features)
output_uri = 'gs://mastersproject-252719.appspot.com/json'
# [END video_shot_tutorial_construct_request]
print('\nProcessing video for shot change annotations:')
# [START video_shot_tutorial_check_operation]
result = operation.result(timeout=120)
print('\nFinished processing.')
# [END video_shot_tutorial_check_operation]
# [START video_shot_tutorial_parse_response]
for i, shot in enumerate(result.annotation_results[0].shot_annotations):
start_time = (shot.start_time_offset.seconds +
shot.start_time_offset.nanos / 1e9)
end_time = (shot.end_time_offset.seconds +
shot.end_time_offset.nanos / 1e9)
print('\tShot {}: {} to {}'.format(i, start_time, end_time))
# [END video_shot_tutorial_parse_response]
Я ищу файл jsonрезультатов, которые будут созданы и помещены в gs: //mastersproject-252719.appspot.com/json