// Start the prediction
const response = await each.predictions.run({
model: "text-to-song-advanced",
version: "0.0.1",
input: {
"lyrics": "I’m a little teapot, yes it’s true, Here’s an example of what I can do. I can change my handle and my spout, Just tip me over and pour me out!",
"vocal": "female vocal",
"mood": "relaxed",
"genre": "pop"
},
});
// Response contains the prediction ID
console.log(response);
// {
// "status": "success",
// "message": "Prediction created successfully",
// "predictionID": "990619d5-9a78-42af-bf6f-90e4add5b228"
// }
// Poll for results using the prediction ID
const result = await each.predictions.get(response.predictionID);
if (result.status === "success") {
console.log("Prediction completed successfully:", result);
} else if (result.status === "error") {
console.log("Prediction failed:", result);
} else if (result.status === "cancelled") {
console.log("Prediction was cancelled:", result);
}