async function query(data) {
const response = await fetch(
"https://api-inference.huggingface.co/models/ehristoforu/dalle-3-xl-v2",
{
headers: { Authorization: "Bearer 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" },
method: "POST",
body: JSON.stringify(data),
}
);
const result = await response.blob();
return result;
}
query({"inputs": "Astronaut riding a horse"}).then((response) => {
// Use image
});