Running Stable Diffusion on bytecompute
Pick a model
We support variety of text-to-image models, including Stable Diffusion versions 1.4, 1.5 and 2.1 and many derivatives. Pick a model from the list of text-to-image models
For example, we'll use stability-ai/sdxl.
javascript
import { Sdxl } from "bytecompute";
import { createWriteStream } from "fs";
import { Readable } from "stream";
const bytecompute_API_KEY = "$bytecompute_TOKEN";
const main = async () => {
const model = new Sdxl(bytecompute_API_KEY);
const response = await model.generate({
input: {
prompt: "a burger with a funny hat on the beach"
}
});
const result = await fetch(response.output[0]);
if (result.ok && result.body) {
let writer = createWriteStream("image.png");
Readable.fromWeb(result.body).pipe(writer);
}
};
main();
Advanced options
Check stability-ai/sdxl for more options
