Working with Twelve Labs in Pixeltable

Twelve Labs provides multimodal embeddings that project text, images, audio, and video into the same semantic space. This enables true cross-modal search - the most powerful feature of this integration.

Providers · Notebook · Updated

Colab runs it in your browser. If it calls a model provider, it asks for that provider's API key in a cell.

What it covers

  • Cross-Modal Video Search
  • Embedding Options
  • Other Modalities: Text, Images, and Documents

What it uses

Install
terminal
pip install pixeltable twelvelabs
Environment variables it names
TWELVELABS_API_KEY
Pixeltable calls
pxt.create_table()pxt.create_view()insert()add_embedding_index()similarity()add_computed_column()

A look at the code

working-with-twelvelabs.ipynb
# Create a view that segments the video into searchable chunks
# Twelve Labs requires minimum 4 second segments
video_chunks = pxt.create_view(
'twelvelabs_demo/video_chunks',
video_t,
iterator=pxtf.video.video_splitter(
video=video_t.video, duration=5.0, min_segment_duration=4.0
),
)
# Add embedding index for cross-modal search
video_chunks.add_embedding_index(
'video_segment',
embedding=pxtf.twelvelabs.embed.using(model_name='marengo3.0'),
)

One cell of the notebook, copied as it is. Open it in Colab for the rest.

Browse all 103