Documentation Index
Fetch the complete documentation index at: https://docs.pixeltable.com/llms.txt
Use this file to discover all available pages before exploring further.
create, edit, and
remix endpoints directly from tables so you can iterate on visuals
without leaving your data workflows.
What is Reve?
Reve is an image generation/editing service with three API endpoints:create: Generate new images from text promptsedit: Edit existing images with natural language instructionsremix: Blend multiple images together
Documentation
Prerequisites
- A Reve account with an API key (see https://api.reve.com/ for instructions)
create, edit, and remix—one at a time.
Setup
Create a Pixeltable directory to keep the tables for this demo separate from anything else you’re working on.Connected to Pixeltable database at: postgresql+psycopg://postgres:@/pixeltable?host=/Users/alison-pxt/.pixeltable/pgdata
Created directory ‘reve_demo’.
<pixeltable.catalog.dir.Dir at 0x12c9d1350>
We’ll create a Pixeltable table that starts with a prompt and a source
image, and ends with a final scene. The table we’ll build up to will
require two inputs per row:
- A prompt for creating a background scene image. We’ll use this
prompt for Reve to create a scene with
reve.create(). - An existing source image. We’ll ask Reve to edit this image with
reve.edit(), and then it will be ready as the foreground image.
reve.remix().
Created table ‘solarpunk_scenes’.
To read more about creating tables, see Tables and Data
Operations.
You can look at the schema for this table:
reve.create() function and a source image for the
reve.edit() function.
Inserted 1 row with 0 errors in 0.03 s (39.10 rows/s)
1 row inserted.
To read more about inserting data, see Bringing
Data.
And we can peek at our starter table with a single row:
Generate new imagery with Reve Create
Usereve.create() when you want Reve to synthesize an entirely new
image from a prompt. In Pixeltable, we place this function call inside a
computed column. We’ll generate fresh imagery from the prompt first in
this section. Feel free to change the prompt. Here we ask for a
solarpunk oasis city.
Added 1 column value with 0 errors in 6.16 s (0.16 rows/s)
1 row updated.
To read more about computed columns in Pixeltable, see Computed
Columns.
fileurl property.
Add Reve parameters
All Reve functions accept optional parameters to customize the output:aspect_ratio: desired image aspect ratio, e.g. ‘3:2’, ‘16:9’, ‘1:1’, etc. (available forreve.create()andreve.remix())version: specific model version to use (optional; defaults to latest if not specified). Available for all Reve functions (reve.create(),reve.edit(), andreve.remix())
Added 1 column value with 0 errors in 6.22 s (0.16 rows/s)
1 row updated.
reve.create(), see reve.create
UDF.
Edit an existing photo with Reve Edit
reve.edit() takes an existing image plus natural-language instructions
and returns an edited version. We already have a source_image column
in our table from the initial setup.
reve.edit() to modify the
source image. To read more about reve.edit(), see reve.edit
UDF.
This editing prompt is integrated into our computed column logic in
Pixeltable, as opposed to our creating example where we saved the prompt
as its own column. This means that the same prompt will be applied to
any new rows that we insert into this table. We will phrase the editing
prompt to reflect this table’s solarpunk theme, but otherwise keep it
general. This way, we don’t need to provide a specific prompt for every
new table row.
Added 1 column value with 0 errors in 16.54 s (0.06 rows/s)
1 row updated.
We can use collect() to see the new image:
Remix multiple references with Reve Remix
reve.remix() blends multiple reference images. Inside the prompt
string, you reference each image with a numbered placeholder:
<img>0</img>refers toimages[0]<img>1</img>refers toimages[1]- etc.
aspect_ratio and version parameters (both
default to latest/auto if not specified).
In the next cell we place the edited subject from <img>0</img> (the
first entry in the images list) into the scene from <img>1</img> (the
second entry).
Added 1 column value with 0 errors in 18.58 s (0.05 rows/s)
1 row updated.
To read more about reve.remix(), see reve.remix
UDF.
Insert a new row
So far, we have been building up our table schema with a single row. Now we’ll insert a new row, with two fresh input values:- A text prompt to create the scene image with
reve.create()and - A source image to edit with
reve.edit()and remix into that scene withreve.remix().
Inserted 1 row with 0 errors in 34.30 s (0.03 rows/s)
1 row inserted.
Now we can inspect both outputs because the insert() in Pixeltable
triggers our computed columns to update for any that are missing values
(existing images we already generated are not changed because Pixeltable
does incremental updates). For example, here is our inserted image and
our edited image:
Review Reve in Pixeltable
Below is a quick recap of how each Reve function maps inputs to outputs inside Pixeltable tables. Each function reads input parameters and writes its results into computed columns.Reve Create
- Input parameter: A prompt inserted as a row inside a Pixeltable
Reve Edit
- Input parameter: A source image of type
pxt.Image - Usage reminder: The edit instructions live inline inside the
add_computed_column()call
Reve Remix
- Input parameters: We started with two image columns
- How the prompt references them:
images=[my_table.image00, my_table.image01]- Inside the prompt,
<img>0</img>points atimages[0]and<img>1</img>points atimages[1]
- Usage reminder: Always keep the placeholders and the order of
the
imageslist in sync; add more<img>n</img>tags if you pass more reference images.
Learn more
- Reve API reference: https://api.reve.com/console/docs
- Pixeltable documentation: https://docs.pixeltable.com/sdk/latest/reve#module-pixeltable-functions-reve