Api Text-to-Image

GuoFeng3
api Text-to-Image
How to set optional parameters?

hi @blansj
Not possible to change params via WidgetUI, however you you can explore the API Inference with rate limit via simple requests, or using or Python client or JavasScript client, here is an example with JS,

(async () => {
  const PROMPT =
    "best quality masterpiece highres 1girl china dress Beautiful face";
  const NEGATIVE_PROMPT =
    "NSFW, lowres,bad anatomy,bad hands, text, error, missing fingers,extra digit, fewer digits, cropped, worstquality, low quality, normal quality,jpegartifacts,signature, watermark, username,blurry,bad feet";
  const HF_TOKEN = ""; //with TOKEN you have more images
  const HFInference = (
    await import("https://cdn.jsdelivr.net/npm/@huggingface/inference/+esm")
  ).HfInference;
  const hf = new HFInference(HF_TOKEN);
  await hf
    .textToImage({
      inputs: PROMPT,
      parameters: {
        negative_prompt: NEGATIVE_PROMPT,
        width: 768,
        height: 768
      },
      model: "xiaolxl/GuoFeng3"
    })
    .then((blob) => {
      window.open(URL.createObjectURL(blob), "_blank");
    });
})()
1 Like