async function query(data) {
const response = await fetch(
"https://api-inference.huggingface.co/models/runwayml/stable-diffusion-v1-5",
{
headers: {
Authorization: "Bearer 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" },
method: "POST",
body: JSON.stringify(data),
}
);
const result = await response.json();
return result;
}
query({inputs: "Write me a book cover for Star Wars if it was a wild west comic"}).then((response) => {
console.log(JSON.stringify(response));
});
// fetch("https://api.openai.com", {
// method: "POST",
// headers: { "Content-Type": "application/json" } })
// .then(response => console.log(response));