let job = await createJob({ | |
prompt: "puppies in a cloud, 4k", | |
}); | |
console.log("Job Created! Waiting..."); | |
while (job.status !== "succeeded" && job.status !== "failed") { | |
await new Promise((resolve) => setTimeout(resolve, 250)); | |
job = await getJob(job.job); | |
} | |
if(job.status !== "succeeded") { | |
throw new Error("Job failed!"); | |
} | |
console.log("Generation completed!", job.imageUrl); |