Tagging media with Google Cloud APIs
Prerequisites
- A GCP project with billing account attached
- Video Intelligence API and Vision API enabled.
Supported media
- IMAGE
- VIDEO
Installation
pip install media-tagging[google-cloud]
uv pip install media-tagging[google-cloud]
If you want to use server capabilities of media-tagger
you need to install additional dependencies:
pip install media-tagging[server]
Usage
Important
google-cloud
tagger only supports tag
command.
media-tagger tag MEDIA_PATHs \
--media-type IMAGE \
--tagger google-cloud
import media_tagging
media_tagger = media_tagging.MediaTaggingService()
request = media_tagging.MediaTaggingRequest(
media_type='IMAGE',
media_paths=['image1.png', 'image2.png'],
tagger_type='google-cloud',
)
result = media_tagger.tag_media(request)
result.save(output='tagging_results', writer='csv')
curl -X 'POST' \
'http://127.0.0.1:8000/media_tagging/tag' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"tagger_type": "google-cloud",
"media_type": "IMAGE",
"media_paths": [
"image1.png",
"image2.png"
]
}'
n_tags
google-cloud
tag support n_tags
parameter to limit number of tags returned from API.
Learn more.