What is Tagging?
Tagging applies custom and automated tags to a video.
The path to use tagging:
Running Tagging
The basic use of tagging to get AI generated tags:
resp = moonshine.run(
flow="core/tagging",
index="your-index",
video_id="[file_id].mp4",
)
Tagging only runs on one video at a time. It will have to be run multiple times to tag multiple videos.
To use custom tags, add a the tags
parameter:
resp = moonshine.run(
flow="core/tagging",
index="your-index",
video_id="[file_id].mp4",
tags=["basketball", "baseball", "soccer"],
)
By default, tagging will assign multiple tags to a video. To set the number of tags use num_tags
:
resp = moonshine.run(
flow="core/tagging",
index="your-index",
video_id="[file_id].mp4",
tags=["basketball", "baseball", "soccer"],
num_tags = 2
)
Note that num_tags
is the maximum number of tags that will be assigned to the video and can be lower.
Tagging returns a json with the following structure:
List of tags assigned to the video
List of tags assigned to the video
Completion status of the tagging operation
Video ID of the tagged video
Example:
{
"output": ["basketball"],
"status": "complete",
"video_id": "[file_id].mp4"
}
Tagging Complete Example
A complete example that runs tagging over an entire index:
import moonshine
moonshine.configure("YOUR-TOKEN-HERE")
index = "my-sports-videos"
items = moonshine.items(index=index)
tags_to_use = ["basketball", "baseball", "soccer"]
for item in items:
file_id = item["file_id"]
file_name = item["file_name"]
print(f"Tagging video: {file_name} (ID: {file_id})")
resp = moonshine.run(
flow="core/tagging",
index=index,
video_id=file_id,
tags=tags_to_use,
num_tags=1
)
print(f"Tagging results for {file_name}: {resp}")
Tagging JSON
Workflows are in a private beta. Please contact us at team@usemoonshine.com to request access.
.run(flow='core/tagging', ...) params
Name/ID of the parent index of the video being processed.
ID of the video being processed.
List of tags to assign to the video.
maximum number of tags that will be assigned to the video and can be lower.
Responses are generated using AI and may contain mistakes.