Skip to main content

module pixeltable.functions.reve

View source on GitHub Pixeltable UDFs that wrap Reve image generation API. In order to use them, the API key must be specified either with REVE_API_KEY environment variable, or as api_key in the reve section of the Pixeltable config file.

udf create()

create(
    prompt: String,
    *,
    aspect_ratio: String | None = None,
    version: String | None = None
) -> Image
Creates an image from a text prompt. This UDF wraps the https://api.reve.com/v1/image/create endpoint. For more information, refer to the official API documentation. Parameters:
  • prompt (String): prompt describing the desired image
  • aspect_ratio (String | None): desired image aspect ratio, e.g. ‘3:2’, ‘16:9’, ‘1:1’, etc.
  • version (String | None): specific model version to use. Latest if not specified.
Returns:
  • Image: A generated image
Examples: Add a computed column with generated square images to a table with text prompts:
t.add_computed_column(
    img=reve.create(t.prompt, aspect_ratio='1:1')
)

udf edit()

edit(
    image: Image,
    edit_instruction: String,
    *,
    version: String | None = None
) -> Image
Edits images based on a text prompt. This UDF wraps the https://api.reve.com/v1/image/edit endpoint. For more information, refer to the official API documentation Parameters:
  • image (Image): image to edit
  • edit_instruction (String): text prompt describing the desired edit
  • version (String | None): specific model version to use. Latest if not specified.
Returns:
  • Image: A generated image
Examples: Add a computed column with catalog-ready images to the table with product pictures:
t.add_computed_column(
    catalog_img=reve.edit(
        t.product_img,
        'Remove background and distractions from the product picture, improve lighting.'
    )
)

udf remix()

remix(
    prompt: String,
    images: Json,
    *,
    aspect_ratio: String | None = None,
    version: String | None = None
) -> Image
Creates images based on a text prompt and reference images. The prompt may include <img>0</img>, <img>1</img>, etc. tags to refer to the images in the images argument. This UDF wraps the https://api.reve.com/v1/image/remix endpoint. For more information, refer to the official API documentation Parameters:
  • prompt (String): prompt describing the desired image
  • images (Json): list of reference images
  • aspect_ratio (String | None): desired image aspect ratio, e.g. ‘3:2’, ‘16:9’, ‘1:1’, etc.
  • version (String | None): specific model version to use. Latest by default.
Returns:
  • Image: A generated image
Examples: Add a computed column with promotional collages to a table with original images:
t.add_computed_column(
    promo_img=(
        reve.remix(
            'Generate a product promotional image by combining the image of the product'
            ' from <img>0</img> with the landmark scene from <img>1</img>',
            images=[t.product_img, t.local_landmark_img],
            aspect_ratio='16:9',
        )
    )
)