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