Generate high quality images using SDXL with refiner
pip install --upgrade cerebrium
to upgrade it to the latest version.cerebrium.toml
:
main.py
file for our Python code. This simple implementation can be done in a single file. First, let’s define our request object:
prompt
and url
parameters are required, while all others are optional. Missing required parameters will trigger an automatic error message.
predict
function since it only needs to be loaded once at startup. While the model downloads during initial deployment, it’s automatically cached in persistent storage for subsequent use.
predict
function takes parameters from the request and passes them to the SDXL model to generate images. We convert images to base64 for direct JSON-serializable responses instead of writing to S3.