-
Notifications
You must be signed in to change notification settings - Fork 48
Open
Description
This example code is for running SDXL from this page: https://www.baseten.co/library/stable-diffusion-xl/
const axios = require('axios');
const os = require('os');
const BASETEN_API_KEY = process.env.BASETEN_API_KEY;
const modelId = ''; // Replace with your model id
const data = {
prompt: 'a little boy looking through a large magical portal, the boy sees a futuristic human civilization in that portal, extremely detailed, trending on artstation, 8k',
};
// Call model endpoint
axios.post(`https://model-${modelId}.api.baseten.co/production/predict`, data, {
headers: {
Authorization: `Api-Key ${BASETEN_API_KEY}`,
},
})
.then((response) => {
const output = response.data.data;
// Process the output as needed
console.log('Output:', output);
})
.catch((error) => {
console.error('Error:', error.message || error);
});
I found that it's an async request that only works for long running servers. I am using Vercel and it's a serverless function that has short timeout span so I need a way to pass a webhook route to the request somehow.
I need baseten to notify my webhook route when the prediction finishes because I cannot keep polling the data on short-lived functions.
This is an example of the webhook feature from runpod: https://docs.runpod.io/serverless/endpoints/send-requests#--webhook
When can I get this feature and if not, what is the workaround?
Metadata
Metadata
Assignees
Labels
No labels