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.