from flushai.integrations.laion import LAIONWrapper

Initialization

We use LAION-Aesthetic v2.6+, a database of 12 million image-text pairs. These images all have a predicted aesthetic score of 6 or higher. LAION-Aesthetic v2.6+ is a subset of LAION-2B-EN, which is a database of 2.3 billion English-captioned images used to initially train Stable Diffusion.

wrapper = LAIONWrapper()

As the database is publicly available, there is no need for an API key.

Retrieving Results

The search function can be used to retrieve results by passing in a prompt. By default, only 10 images are retrieved, but you can pass in a custom number of images to retrieve.

wrapper.search("antarctic peninsula iceberg landscape", num=3)

A Document is returned. For reference, we provide the images returned below: