Skip to content

Commit

Permalink
add example
Browse files Browse the repository at this point in the history
  • Loading branch information
harshitgupta412 committed Nov 13, 2024
1 parent da28054 commit 11425fa
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions examples/multimodal_data/filter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import pandas as pd
from torchvision import datasets
import lotus
from lotus.models import LM
from lotus.dtype_extensions import ImageArray

lm = LM(model="gpt-4o-mini")
lotus.settings.configure(lm=lm)

mnist_data = datasets.MNIST(root='mnist_data', train=True, download=True, transform=None)

images = [image for image, _ in mnist_data]
labels = [label for _, label in mnist_data]

df = pd.DataFrame({
"image": ImageArray(images),
"label": labels
})

df.sem_filter("{image} represents number 1")

0 comments on commit 11425fa

Please sign in to comment.