Public
Script
Readme

fal/sdxl

This val is an example usage sdxl with fal.ai's javascript client.

https://www.fal.ai/models/stable-diffusion-xl

The client offers a way for you to subscribe to queue updates. This is useful if you want to get notified when a function is done running, or if you want to get the logs as they are being generated.

import fal from "npm:@fal-ai/serverless-client"; const result = await fal.subscribe(FUNCTION_ID, { input: { seed: 176400, }, pollInterval: 5000, logs: true, onQueueUpdate: (update) => { console.log(update.status); if (update.status === "IN_PROGRESS") { update.logs.map((log) => log.message).forEach(console.log); } }, }); console.log(result.url);

The onQueueUpdate callback will be called every time the queue status changes. The update object contains the queue status data as documented on the status types section.

1
2
3
4
5
6
7
import fal from "npm:@fal-ai/serverless-client";
export let sdxl = async (input: { prompt: string }): Promise<{images: [{url: string}]}> => {
return await fal.subscribe("fal-ai/fast-sdxl", {
input: input,
});
};
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
February 6, 2024