Text-to-Image Models
This notebook will go over text-to-image models, which are diffusion models that take in text as input and output image(s)
Base Models
Let’s first see how we can generate images with Stable Diffusion XL:
from flushai.models.txt2img import StableDiffusionXL
model = StableDiffusionXL(api_key="YOUR_API_KEY")
model.generate(
prompt = 'A photo of a tiger',
negative_prompt = 'blurry, low quality',
num_images = 4,
height = 512,
width = 512,
steps = 25,
prompt_strength = 7.5,
seed = 5,
)
All parameters are optional other than prompt
. For more information on base models offered, see here.
Custom Models
Next, let’s see how we can generate images with custom models made on Flush:
from flushai.models.txt2img import Txt2ImgBase
model = Txt2ImgBase(api_key="YOUR_API_KEY")
model.generate(
model_id = "c50c49b4-14ae-4812-9bae-7e8be651baa8",
prompt = 'A photo of a tiger',
negative_prompt = 'blurry, low quality',
num_images = 4,
height = 512,
width = 512,
steps = 25,
prompt_strength = 7.5,
seed = 5,
)
We get an array of image links as output.
All parameters are optional other than prompt
and model_id
. For more information on how to create custom models to deploy, see here.
DALLE
Flush also supports interaction with DALLE-2. In this case, we use DALLE’s image generation endpoint. We show an example of this below:
from flushai.models.txt2img import DALLE
model = DALLE()
model.generate(
prompt = 'A photo of a tiger',
num_images = 4,
size = 512
)
It is important to note that DALLE only supports image sizes 256x256, 512x512, or 1024x1024. All parameters are optional other than prompt
.