Skip to content

Media Tagging

garf for Media Tagging API

PyPI Downloads PyPI

garf-media-tagging simplifies interaction with media_tagging library via SQL queries and can be used with garf framework.

Prerequisites

  • media_tagging library installed locally or running as a HTTP service.

Installation

pip install garf-media-tagging

Usage

Run via CLI

Install garf-executors package to run queries via CLI (pip install garf-executors).

garf <PATH_TO_QUERIES> --source media-tagging \
  --output <OUTPUT_TYPE> \
  --source.endpoint=MEDIA_TAGGING_API_ENDPOINT_URL

where:

Available source parameters

name values comments
endpoint http endpoint when media-tagging API is running
db-uri Optional connection string to DB where tagging results can be found

Queries for Media Tagging API

SELECT
  media_url,
  content.tags[].name AS tags
FROM tag
WHERE
  media_type = 'image'
  AND tagger_type = 'gemini'
  AND media_path IN ({{media}})

Resources

  • tag - identifies tags (pair name: score) uniquely defining media.
  • description - custom description of media; usually fine-tuned via custom_prompt parameter.

Filters

  • media_type - Required, one of: IMAGE, YOUTUBE_VIDEO, WEBPAGE, TEXT, VIDEO.
  • tagger_type - Tagger used to identify tags / descriptions.
  • media_path - location of media.
  • tagging_options - optional parameters to fine-tune tagging.
  • n_tags - number of tags to return.
  • tags - custom tags to find in the media.
  • custom_prompt - prompt to send to LLM.
  • custom_schema - schema for structured output.

Fields

You can extract one of the following elements from reach row of API response.

  • media_type
  • media_url
  • identifier
  • processed_at
  • content
    • text for description
    • {name, score} for tag
  • hash