Skip to main content

Performs tagging of image and videos based on various taggers

Project description

Media Tagger

Problem statement

When analyzing large amount of creatives of any nature (being images and videos) it might be challenging to quickly and reliably understand their content and gain insights.

Solution

media-tagger performs tagging of image and videos based on various taggers

  • simply provide a path to your media files and media-tagger will do the rest.

Deliverable (implementation)

media-tagger is implemented as a:

  • library - Use it in your projects with a help of media_tagging.tagger.create_tagger function.
  • CLI tool - media-tagger tool is available to be used in the terminal.
  • HTTP endpoint - media-tagger can be easily exposed as HTTP endpoint.
  • Langchain tool - integrated media-tagger into your Langchain applications.

Deployment

Prerequisites

  • API key to access to access Google Gemini.
    • Once you created API key export it as an environmental variable

      export GOOGLE_API_KEY=<YOUR_API_KEY_HERE>
      

Installation

Install media-tagger with pip install media-tagging[all] command.

Alternatively you can install subsets of media-tagging library:

  • media-tagging[api] - tagging videos and images with Google Cloud APIs.
    • media-tagging[image-api] - only for tagging images.
    • media-tagging[video-api] - only for tagging videos.
  • media-tagging[llm] - tagging videos and images with LLMs.
    • media-tagging[base-llm] - only for tagging images with llms.
    • media-tagging[google-genai] - only for tagging images via Gemini.
    • media-tagging[google-vertexai] - only for tagging videos via Gemini.

Usage

This section is focused on using media-tagger as a CLI tool. Check library, http endpoint, langchain tool sections to learn more.

Once media-tagger is installed you can call it:

media-tagger MEDIA_PATHs \
  --media-type <MEDIA_TYPE> \
  --tagger <TAGGER_TYPE> \
  --db-uri=<CONNECTION_STRING> \
  --writer <WRITER_TYPE> \
  --output <OUTPUT_FILE_NAME>

where:

  • MEDIA_PATHs - names of files for tagging (can be urls).
  • <MEDIA_TYPE> - type of media (YOUTUBE_VIDEO, VIDEO, IMAGE).
  • <TAGGER_TYPE> - name of tagger, supported options.

Tagger can be customized via tagger.option=value syntax. I.e. if you want to request a specific number of tags you can add --tagger.n-tags=100 CLI flag.

  • <CONNECTION_STRING> - Optional connection string to the database with tagging results (i.e. sqlite:///tagging.db). If this parameter is set make sure that DB exists.

To create an empty Sqlite DB execute touch database.db.

  • <WRITER_TYPE> - writer identifier (check available options at garf-io library).
  • <OUTPUT_FILE_NAME> - name of the file to store results of tagging (by default tagging_results).

Supported taggers

Google Cloud API Taggers

identifier options description
vision-api n-tags=10 For tagging images based on Google Cloud Vision API
video-api n-tags=10 For tagging images based on Google Cloud Video Intelligence API

LLM Taggers

Each LLM tagger can use custom-prompt parameter to adjust built-in prompt.

Image taggers
identifier options description
gemini-image n-tags=10 Uses Vertex AI to tags images.
gemini-structured-image tags=tag1,tag2,tag3 Uses Vertex AI to tags images
gemini-description-image Uses Vertex AI to describe image
Video file taggers
identifier options description
gemini-video n-tags=10 Uses Vertex AI to tags videos.
gemini-structured-video tags=tag1,tag2,tag3 Uses Vertex AI to tags videos
gemini-description-video Uses Vertex AI to describe
YouTube video taggers
identifier options description
gemini-youtube-video n-tags=10 Uses Vertex AI to tags YouTube videos.
gemini-structured-youtube-video tags=tag1,tag2,tag3 Uses Vertex AI to tags YouTube videos
gemini-description-youtube-video Uses Vertex AI to describe YouTube Video

Disclaimer

This is not an officially supported Google product.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

media_tagging-0.8.0.dev1.tar.gz (23.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

media_tagging-0.8.0.dev1-py3-none-any.whl (32.3 kB view details)

Uploaded Python 3

File details

Details for the file media_tagging-0.8.0.dev1.tar.gz.

File metadata

  • Download URL: media_tagging-0.8.0.dev1.tar.gz
  • Upload date:
  • Size: 23.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.4

File hashes

Hashes for media_tagging-0.8.0.dev1.tar.gz
Algorithm Hash digest
SHA256 efd7cf03387263b161ff38f8eb016eb971c7096cb7a9b341b58bdfa9800ecd02
MD5 6afe3b278adc59d853195c07b753a967
BLAKE2b-256 3a3c14421fefc4ed8a924dca5ebb3379af0962aade73b25ca2b5bda16fb15254

See more details on using hashes here.

File details

Details for the file media_tagging-0.8.0.dev1-py3-none-any.whl.

File metadata

File hashes

Hashes for media_tagging-0.8.0.dev1-py3-none-any.whl
Algorithm Hash digest
SHA256 b11f55cbe1cc44e0084ddc62a9d48678f541a0cd2eefa39036321bc5eb62443d
MD5 30f5de20531ade35acaf4b496c38deaf
BLAKE2b-256 73b64ce96dc8e3529035848a44b66981548f27a22c6014b21a77942059c25ecd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page