

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Still calibrating
click for more info
Not enough gems
Cost: 6 gems
1: Multimodal Search
incomplete
2: Multimodal Embeddings
incomplete
3: Image Embeddings
incomplete
4: Multimodal Search Implementation
incomplete
This lesson's interactive features are locked, please to keep using them
Let's put it all together with a multimodal search function. It will generate embeddings for the text in our movie dataset, then allow us to provide an image to search for similar movies.
With CLIP models, it's even possible to construct hybrid queries that combine text and images. We can do this by taking a weighted average of a text embedding and an image embedding, then adjusting the weighting however we like.
# User uploads an image AND types text
uploaded_image = Image.open("user_upload.jpg")
text_modifier = "but with bears"
# Encode both inputs
image_embedding = model.encode_image([uploaded_image])
text_embedding = model.encode_text([text_modifier])
# Combine embeddings (weighted average)
combined_query = (0.7 * image_embedding) + (0.3 * text_embedding)
We won't go this far in the current project, but with different modalities embedded in the same vector space, we can mix and match them in all sorts of ways.
Implement image-based search to find movies by uploading images instead of typing queries.
f"{doc['title']}: {doc['description']}"
1. Paddington (similarity: 0.722)
Deep in the rainforests of Peru, a young bear lives peacefully with his Aunt Lucy and Uncle Pastuzo,...
2. Murder She Said (similarity: 0.686)
This is based on the Agatha Christie book "4:50 from Paddington" and the opening locale is Paddingto...
3. Ted (similarity: 0.685)
In 1985, eight-year-old John Bennett makes a Christmas wish that his teddy bear, Ted, would come to ...
Run and submit the CLI tests.