import axios from 'axios';
axios.post('https://api.artificialstudio.ai/api/generate', {
model: 'try-clothes',
input: {
human : "https://replicate.delivery/pbxt/KgwTlhCMvDagRrcVzZJbuozNJ8esPqiNAIJS3eMgHrYuHmW4/KakaoTalk_Photo_2024-04-04-21-44-45.png",
garment : "https://replicate.delivery/pbxt/KgwTlZyFx5aUU3gc5gMiKuD5nNPTgliMlLUWx160G4z99YjO/sweater.webp",
garment_description : "cute pink top",
category : "upper_body"
},
webhook: 'https://your-webhook-url.com/api/webhook',
}, {
headers: {
'Content-Type': 'application/json',
'Authorization': 'YOUR_API_KEY'
}
}).then(res => {
console.log('Success:', res.data);
}).catch(error => {
console.error('Error:', error);
});
app.post("/api/webhook", (req: any, res: any) => {
console.log(req.body) // id, output, status, model, payload, error...
res.send("Webhook received");
});