Stable Diffusion with Civitai

Use Civitai Model id and Loras. Faster than previous myshell-visual;

Try it in the Widget Center

Click this url to try this widget and copy the Pro Config template.

Usage

Based on your description (text prompt), generate image with various sizes and styles

Input Parameters

NameTypeDescriptionDefaultRequired

model

string

The model id from civitai (SD1.5, SDXL 1.0, PlaygroundV2). How to get it? Click on a model page on civitai, and copy the series number within the download link.

64094

prompt

string

The text prompt for image generation. Add lora? add `` to your prompt. `$id` is the series number and `$weight` is the lora weight you want (always set to 1.0). You can use multiple loras.

negative_prompt

string

The negative prompt for image generation.

(worst quality, low quality:1.4),(malformed hands:1.4),(poorly drawn hands:1.4),(mutated fingers:1.4),(extra limbs:1.35),(poorly drawn face:1.4),bad leg,strange leg, poor eyes, full screen of face

sampler

string

Sampler for diffusion model inference

DPM++ 2M Karras

height

integer

Height of the generated images

512

width

integer

Width of the generated images

512

steps

integer

Steps for sampler to step whle sampling

25

cfg_scale

number

Classifier Free Guidance Scale - how strongly the image should conform to prompt - lower values produce more creative results. Default to 7.

7.0

seed

integer

Random seed for generation process. -1 means random seed

-1

clip_skip

integer

Early stopping parameter for CLIP model; 1 is stop at last layer as usual, 2 is stop at penultimate layer, etc.

1

enable_hr

boolean

Enable the post-process high resolution. If it is set to false, please ignore the parameter with prefix `hr_`

False

hr_scale

integer

Improve the image quality by enlarging it in a way while maintains the original ratios. Default to 2. If `hr_height` or `hr_width` is set to a value other than zero, this parameter will not be applied.

2

hr_upscaler

string

The super resolution model used

ESRGAN_4x

hr_resize_x

integer

Resize width to, 0 means not defined. If x set to 0, and y is not 0, we will resize the length of image to y and change width accordingly

0

hr_resize_y

integer

Resize height to, 0 means not defined. If y set to 0, and x is not 0, we will resize the width of image to x and change width accordingly

0

hr_second_pass_steps

integer

Steps of sampling for second pass of diffusion model after hires. Set to 0 means the same steps as first pass.

0

hr_denoising_strength

number

Strength of image transfomation during hires transform. High means more influence during second pass sampling after hires

0.7

Output Parameters

NameTypeDescriptionFile Type

url

string

The url of generated image, stored in the cloud. Only temporarily effective, will be cleared in a few hours.

image

Output Example

{
  "url": "https://image.myshell.ai/image/chat/embed_obj/40295/20240423/8cf3621c509f4235839f1014b3ff97a4.jpg"
}

Detailed Guidelines

  • Main parameter:

    • model

      • The model id from civitai (SD1.5, SDXL 1.0, PlaygroundV2).

      • How to get it?

        • Click on a model page on civitai, and copy the version ID from the page.

        • Example: https://civitai.com/models/10028?modelVersionId=64094 , use model = 64094 for this model

    • prompt

      • The text prompt for image generation.

      • Add lora?

        • add <lora:$id:$weight> to your prompt. $id is the series number and $weight is the lora weight you want (always set to 1.0). You can use multiple loras.

        • Example: <lora:426797:1> A young boy is seated on the ground.

          • Here, we add lora=426797 with weight 1 for this generation guided by text A young boy is seated on the ground

    • height & width

      • The resolution for your generated images.

        • We recommend to generate 512 * 512 images with SD 1.5 and 1024 * 1024 images with SDXL 1.0

  • Other functional parameter:

    • enable_hr: Enable the post-process high resolution. If it is set to false, please ignore the parameter with prefix hr_

      • hr_upscaler: Model for first step super resolution:

        • Choose from ["None", "Lanczos", "Nearest", "ESRGAN_4x", "LDSR", "R-ESRGAN 4x+", "R-ESRGAN 4x+ Anime6B", "ScuNET GAN", "ScuNET PSNR", "SwinIR 4x"]

      • hr_scale : Improve the image quality by enlarging it in a way while maintains the original ratios. Default to 2.

        • For example, when enable_hr=True and hr_scale=2 , you generated image will be (2*width, 2*height)

        • If hr_height or hr_width is set to a value other than zero, this parameter will be ignored.

      • hr_resize_x and hr_resize_y : Resize width/height to.

        • 0 means not defined. If x set to 0, and y is not 0, we will resize the length of image to y and change width accordingly. Vice versa

        • For example, when enable_hr=True and hr_resize_x=1024 , and you set the width=512 to obtain an image with 512 pixels on width. Finally you will get a image with (1024, 1024/512 * height)

      • hr_second_pass_steps: Steps of sampling for second pass of diffusion model after hires. Set to 0 means the same steps as first pass.

        • Feel free to use 0 for most cases.

      • hr_denoising_strength: Strength of image transfomation during hires transform. High means more influence during second pass sampling after hires

        • The weighted sum will be computed based on the images after super-resolution and after the second inference

        • Set 0.7 for default.

Last updated