Accelerate your SDXL web app
Learn from Thierry Moreau, Co-Founder at OctoML, how to build a Next.JS web app calling OctoAI’s Image Gen SDXL optimized APIs to get blazing fast image generation. Key learnings are using OctoAI’s SDXL APIs to reduce image generation time to about 2 seconds.
Quick recap
We have been using the aquarelle app to generate watercolor style AI images coupled with Automatic1111 both web UI and in API mode. Now that we have those basics down, let’s see how we can speed up image generation from over 4 seconds to 2 seconds.
Using SDXL's optimized API
Reviewing the baseline of what we have set up in Auatomatic111, we have an A100 GPU, allowing fast (4.6 seconds) image generation using SDXL in only 20 steps. Now, let’s see if we can get even faster using a highly optimized SDXL API provided by OctoAI. OctoAI’s new pricing model charges only per image, and not for how long the inference is running.
To get started testing:
Login to OctoAI Media Tools
Click the card for SDXL
This lets you play with the API and see results before putting into your app
We tested using the same settings we had in Automatic111
Prompt:
batman eating a hot bowl of pho
Style preset:
watercolor
Sampler:
K_EULER_ANCESTRAL
Steps:
20
CFG Scale:
7
Click on the generated image to see examples of how to call the API
Python
TypeScript
cURL
Building the app
Prerequisites to building the app:
Create an OctoAI account, or login
To build the app (Next.js + typeScript):
Follow the Readme in the Git Repo
Clone the repo
Find the nextjs folder
Add your OctoAI token to
.env
Developing the app
Install dependencies
Start the dev server
The need for speed & what's next
With the release of SDXL Lightning, you can generate SDXL images in just 4 steps and in some cases in less than 1 second. Stay tuned as our next demo in this series will expand on how to use LoRAs with your image generation app.
Share what you build
We are excited to see what you build — feel free to show us in our Discord, and see what other community members are creating.
Your choice of models on our SaaS or in your environment
Run any model or checkpoint on our efficient, reliable, and customizable API endpoints. Sign up and start building in minutes.