Hi, I’m using Hugging face’s Stable Diffusion inference api. I want to know if there are any parameters I can send to post request other than input prompt like number of images or guidance scale?
const generateImage = async (e) => {
e.preventDefault();
setLoading(false);
console.log("Generating Image");
// You can replace this with different model API's
const URL = `https://api-inference.huggingface.co/models/stabilityai/stable-diffusion-2-1`;
// Send the request
const response = await axios({
url: URL,
method: "POST",
headers: {
Authorization: `Bearer ${process.env.NEXT_PUBLIC_HUGGING_FACE_API_KEY}`,
Accept: "application/json",
"Content-Type": "application/json",
},
data: JSON.stringify({
inputs: prompt,
options: { wait_for_model: true },
}),
responseType: "arraybuffer",
});
console.log(response);
const type = response.headers["content-type"];
const data = response.data;
const base64data = Buffer.from(data).toString("base64");
const img = `data:${type};base64,` + base64data; // <-- This is so we can render it on the page
setImage(img);
setLoading(true);
};