Create a Pixeltable Table from a Hugging Face Dataset
Now we create a table and Pixeltable will map column types as needed. Check out other ways to bring data into Pixeltable with pixeltable.io such as csv, parquet, pandas, json and others.| Image | ImageSize | Name | ImageSource |
|---|---|---|---|
| 240993 | AI-Chan | https://knowyourmeme.com/photos/1439336-padoru | |
| 993097 | Platelet | https://knowyourmeme.com/photos/1438687-padoru | |
| 255549 | Nezuko Kamado | https://knowyourmeme.com/photos/1568913-padoru |
Leveraging Hugging Face Models with Pixeltable’s Embedding Functionality
Pixeltable contains a built-in adapter for certain model families, so all we have to do is call the Pixeltable function for Hugging Face. A nice thing about the Huggingface models is that they run locally, so you don’t need an account with a service provider in order to use them. Pixeltable can also create and populate an index withtable.add_embedding_index() for string and image embeddings. That
definition is persisted as part of the table’s metadata, which allows
Pixeltable to maintain the index in response to updates to the table.
In this example we are using CLIP. You can use any embedding function
you like, via Pixeltable’s UDF mechanism (which is described in detail
our guide to user-defined
functions).
| Image | sim |
|---|---|
| 1. | |
| 0.963 | |
| 0.961 |