Programmable Media

Auto-tag images using the Python SDK (video tutorial)

Last updated: Feb-19-2025

Overview

Learn how to automatically tag images on upload with AI using the Cloudinary Python SDK.

Video tutorial


Tutorial contents

This tutorial presents the following topics. Click a timestamp to jump to that part of the video.

Introduction

Jump to this spot in the video  0:00 Storing a large number of images or videos in your Cloudinary Media Library is convenient, but finding a specific item can sometimes be a hassle. The solution? Adding tags to your content. However, manually adding tags to multiple files can be slow and tedious, especially with a big set of files.

Adding tags to content manually and using add-ons

Jump to this spot in the video  0:24 Cloudinary allows you to manually add tags to images for better organization and searchability. Alternatively, you can automate this process by registering for add-ons that enhance Cloudinary’s capabilities. One such add-on is Google Auto Tagging, which uses AI to auto-tag images during the upload process. Let’s see how to use this feature with Python and Flask.

Set up an upload call in Flask

Jump to this spot in the video  0:37 First, set up a simple upload call for uploading a local file to Cloudinary from your Flask app. Assuming the Cloudinary Python SDK is already installed and configured in your environment, in your upload function (called when the client hits the Upload route), pass the data to upload the user-selected file.

Register for the Google Auto Tagging add-on

Jump to this spot in the video  0:49 To enable auto-tagging, visit the Add-ons page in your Cloudinary Console Settings and register for the Google Auto Tagging add-on. Once activated, the auto-tagging feature is available during uploads.

Add auto-tagging to the upload call

Jump to this spot in the video  1:12 Now, add the tagging capability to the upload. Add two key properties to your upload call:
  • categorization: Set this to google_tagging to specify the tagging service.
  • auto_tagging: This is a number (e.g., 0.6) that represents the minimum confidence score required to apply a detected tag.

Enhancing searchability with tags

Jump to this spot in the video  2:01 Launch the app and use it to upload an image. The upload response that's displayed in the app contains the tags assigned during the upload. In addition, the tags are stored with the image in the Media Library. These auto-generated tags make it much easier to search for images within your Media Library. For example, you can search for all images with the "deer" tag and quickly retrieve relevant results.

Keep learning

Related topics

If you like this, you might also like...

 

Cloudinary Academy

 

Check out the Cloudinary Academy for free self-paced Cloudinary courses on a variety of developer or DAM topics, or register for formal instructor-led courses, either virtual or on-site.

 

✔️ Feedback sent!

Rate this page: