|
| 1 | +# Pixeltable Quickstart |
| 2 | + |
| 3 | +import Tabs from "@theme/Tabs"; |
| 4 | +import TabItem from "@theme/TabItem"; |
| 5 | + |
| 6 | +[Pixeltable](https://www.pixeltable.com/) is declarative data infrastructure for |
| 7 | +building multimodal AI applications. It allows you to create and manage tables |
| 8 | +similar to how you create and use tables with database engines like Postgres. |
| 9 | +When you combine Pixeltable and Tigris, you get unlimited media storage with no |
| 10 | +egress fees and truly global scalability. This guide will tell you how to |
| 11 | +configure Pixeltable to work with Tigris. |
| 12 | + |
| 13 | +Pixeltable contains a storage integration for Tigris as of |
| 14 | +[version 0.5.0](https://github.com/pixeltable/pixeltable/releases/tag/v0.5.0). |
| 15 | +This allows you to store your structured data in Pixeltable and have references |
| 16 | +to unstructured multimodal data in Tigris. |
| 17 | + |
| 18 | +In order to configure Pixeltable to use Tigris, you need to set the following |
| 19 | +environment variables or make changes to the configuration file in |
| 20 | +`~/.pixeltable/config.toml`: |
| 21 | + |
| 22 | +<Tabs> |
| 23 | + <TabItem value="config" label="Configuration file" default> |
| 24 | + |
| 25 | +```toml |
| 26 | +[pixeltable] |
| 27 | +# The location where new media files are stored when they are added to tables. |
| 28 | +input_media_dest = "s3://contoso-data/input" |
| 29 | +# The location where media files are stored when they are generated by Pixeltable operations. |
| 30 | +output_media_dest = "s3://contoso-data/output" |
| 31 | +# The name of the AWS configuration profile that is configured for accessing Tigris. |
| 32 | +tigris_profile = "tigris" |
| 33 | +``` |
| 34 | + |
| 35 | + </TabItem> |
| 36 | + <TabItem value="env" label="Environment variables"> |
| 37 | + |
| 38 | +| Environment variable | Example | Description | |
| 39 | +| :----------------------------- | :------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------- | |
| 40 | +| `PIXELTABLE_TIGRIS_PROFILE` | `tigris` | The name of the [AWS configuration profile](/docs/sdks/s3/aws-cli/#using-multiple-aws-profiles) that is configured for accessing Tigris. | |
| 41 | +| `PIXELTABLE_INPUT_MEDIA_DEST` | `s3://contoso-data/input` | The location where new media files are stored when they are added to tables. | |
| 42 | +| `PIXELTABLE_OUTPUT_MEDIA_DEST` | `s3://contoso-data/output` | The location where media files are stored when they are generated by Pixeltable operations. | |
| 43 | + |
| 44 | + </TabItem> |
| 45 | +</Tabs> |
| 46 | + |
| 47 | +Then when you insert a video into a |
| 48 | +[table](https://docs.pixeltable.com/datastore/tables-and-operations): |
| 49 | + |
| 50 | +```py |
| 51 | +import pixeltable as pxt |
| 52 | + |
| 53 | +videos = pxt.create_table( |
| 54 | + "content", |
| 55 | + schema={ |
| 56 | + "video": pxt.Video, |
| 57 | + "title": pxt.String, |
| 58 | + }, |
| 59 | + if_exists="ignore", |
| 60 | +) |
| 61 | + |
| 62 | +videos.insert( |
| 63 | + [ |
| 64 | + { |
| 65 | + "video": "./var/big-buck-bunny.mp4", |
| 66 | + "title": "Big Buck Bunny", |
| 67 | + }, |
| 68 | + ] |
| 69 | +) |
| 70 | +``` |
| 71 | + |
| 72 | +Pixeltable will automatically upload the media file to Tigris as it ingests it. |
| 73 | + |
| 74 | +If you create an image with the |
| 75 | +[OpenAI `image_generation` user-defined function](https://docs.pixeltable.com/sdk/v0.5.1/openai#udf-image-generations), |
| 76 | +the generated image will automatically be uploaded to Tigris: |
| 77 | + |
| 78 | +```py |
| 79 | +import pixeltable as pxt |
| 80 | +from pixeltable.functions import openai |
| 81 | + |
| 82 | +pxt.drop_table("wallpapers") |
| 83 | +wallpapers = pxt.create_table( |
| 84 | + "wallpapers", |
| 85 | + schema={ |
| 86 | + "text": pxt.String, |
| 87 | + }, |
| 88 | + if_exists="ignore", |
| 89 | +) |
| 90 | + |
| 91 | +wallpapers.insert( |
| 92 | + [ |
| 93 | + {"text": "A surrealist oil on canvas painting of a taco dancing in a datacentre"} |
| 94 | + ] |
| 95 | +) |
| 96 | + |
| 97 | +wallpapers.add_computed_column( |
| 98 | + gen_image=openai.image_generations(wallpapers.text, model='dall-e-2') |
| 99 | +) |
| 100 | +``` |
| 101 | + |
| 102 | +You can then browse the generated images in Tigris. |
| 103 | + |
| 104 | +From here, go |
| 105 | +[read the Pixeltable documentation](https://docs.pixeltable.com/overview/pixeltable) |
| 106 | +so you can get started building your next multimodal app. |
0 commit comments