stablediffusion

package
v1.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 6, 2023 License: CC0-1.0 Imports: 8 Imported by: 0

Documentation

Overview

Package stablediffusion provides a simple API client for the Automatic1111 Stable Diffusion web UI.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	HTTP *http.Client
}
var (
	Default *Client = &Client{
		HTTP: http.DefaultClient,
	}
)

func (*Client) Generate

func (c *Client) Generate(ctx context.Context, inp SimpleImageRequest) (*ImageResponse, error)

type ImageInfo

type ImageInfo struct {
	Prompt                string      `json:"prompt"`
	AllPrompts            []string    `json:"all_prompts"`
	NegativePrompt        string      `json:"negative_prompt"`
	AllNegativePrompts    []string    `json:"all_negative_prompts"`
	Seed                  int         `json:"seed"`
	AllSeeds              []int       `json:"all_seeds"`
	Subseed               int         `json:"subseed"`
	AllSubseeds           []int       `json:"all_subseeds"`
	SubseedStrength       int         `json:"subseed_strength"`
	Width                 int         `json:"width"`
	Height                int         `json:"height"`
	SamplerName           string      `json:"sampler_name"`
	CfgScale              float64     `json:"cfg_scale"`
	Steps                 int         `json:"steps"`
	BatchSize             int         `json:"batch_size"`
	RestoreFaces          bool        `json:"restore_faces"`
	FaceRestorationModel  interface{} `json:"face_restoration_model"`
	SdModelHash           string      `json:"sd_model_hash"`
	SeedResizeFromW       int         `json:"seed_resize_from_w"`
	SeedResizeFromH       int         `json:"seed_resize_from_h"`
	DenoisingStrength     int         `json:"denoising_strength"`
	ExtraGenerationParams struct {
	} `json:"extra_generation_params"`
	IndexOfFirstImage             int           `json:"index_of_first_image"`
	Infotexts                     []string      `json:"infotexts"`
	Styles                        []interface{} `json:"styles"`
	JobTimestamp                  string        `json:"job_timestamp"`
	ClipSkip                      int           `json:"clip_skip"`
	IsUsingInpaintingConditioning bool          `json:"is_using_inpainting_conditioning"`
}

type ImageResponse

type ImageResponse struct {
	Images [][]byte `json:"images"`
	Info   string   `json:"info"`
}

func Generate

func Generate(ctx context.Context, inp SimpleImageRequest) (*ImageResponse, error)

type SimpleImageRequest

type SimpleImageRequest struct {
	Prompt           string   `json:"prompt"`
	NegativePrompt   string   `json:"negative_prompt"`
	Styles           []string `json:"styles"`
	Seed             int      `json:"seed"`
	SamplerName      string   `json:"sampler_name"`
	BatchSize        int      `json:"batch_size"`
	NIter            int      `json:"n_iter"`
	Steps            int      `json:"steps"`
	CfgScale         int      `json:"cfg_scale"`
	Width            int      `json:"width"`
	Height           int      `json:"height"`
	SNoise           int      `json:"s_noise"`
	OverrideSettings struct {
	} `json:"override_settings"`
	OverrideSettingsRestoreAfterwards bool `json:"override_settings_restore_afterwards"`
}

SimpleImageRequest is all of the parameters needed to generate an image.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL