types

package
v0.0.0-...-54d18ba Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Initializing ProgressResponseStatusCode = 0
	Running                                 = 1
	Successful                              = 2
	Failed                                  = 3
	Timeout                                 = 4
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AsyncResponse

type AsyncResponse struct {
	Code int                `json:"code"`
	Msg  string             `json:"msg"`
	Data *AsyncResponseData `json:"data"`
}

func (AsyncResponse) GetCode

func (a AsyncResponse) GetCode() int

func (AsyncResponse) GetMsg

func (a AsyncResponse) GetMsg() string

type AsyncResponseData

type AsyncResponseData struct {
	TaskID string `json:"task_id"`
	Warn   string `json:"warn"`
}

type BasicResponse

type BasicResponse interface {
	GetCode() int
	GetMsg() string
}

type CivitaiImage

type CivitaiImage struct {
	URL  string            `json:"url"`
	NSFW string            `json:"nsfw"`
	Meta *CivitaiImageMeta `json:"meta"`
}

type CivitaiImageMeta

type CivitaiImageMeta struct {
	Prompt         string  `json:"prompt"`
	NegativePrompt string  `json:"negative_prompt"`
	SamplerName    string  `json:"sampler_name"`
	Steps          int     `json:"steps"`
	CfgScale       float32 `json:"cfg_scale"`
	Seed           int     `json:"seed"`
	Height         int     `json:"height"`
	Width          int     `json:"width"`
	ModelName      string  `json:"model_name"`
}

type ControlNetControlMode

type ControlNetControlMode int
const (
	Balanced             ControlNetControlMode = 0
	PromptImportance     ControlNetControlMode = 1
	ControlNetImportance ControlNetControlMode = 2
)

type ControlNetModule

type ControlNetModule string
const (
	None                   ControlNetModule = "none"
	Canny                  ControlNetModule = "canny"
	Depth                  ControlNetModule = "depth"
	DepthLeRes             ControlNetModule = "depth_leres"
	DepthLeResPlusPlus     ControlNetModule = "depth_leres++"
	HED                    ControlNetModule = "hed"
	HEDSafe                ControlNetModule = "hed_safe"
	MediaPipeFace          ControlNetModule = "mediapipe_face"
	MLSD                   ControlNetModule = "mlsd"
	NormalMap              ControlNetModule = "normal_map"
	OpenPose               ControlNetModule = "openpose"
	OpenPoseHand           ControlNetModule = "openpose_hand"
	OpenPoseFace           ControlNetModule = "openpose_face"
	OpenPoseFaceOnly       ControlNetModule = "openpose_faceonly"
	OpenPoseFull           ControlNetModule = "openpose_full"
	ClipVision             ControlNetModule = "clip_vision"
	Color                  ControlNetModule = "color"
	PIDINET                ControlNetModule = "pidinet"
	PIDINESafe             ControlNetModule = "pidinet_safe"
	PIDINESketch           ControlNetModule = "pidinet_sketch"
	PIDINEScribble         ControlNetModule = "pidinet_scribble"
	ScribbleXDOG           ControlNetModule = "scribble_xdog"
	ScribbleHED            ControlNetModule = "scribble_hed"
	Segmentation           ControlNetModule = "segmentation"
	Threshold              ControlNetModule = "threshold"
	DepthZOE               ControlNetModule = "depth_zoe"
	NormalBAE              ControlNetModule = "normal_bae"
	OneFormerCOCO          ControlNetModule = "oneformer_coco"
	OneFormerADE20K        ControlNetModule = "oneformer_ade20k"
	Lineart                ControlNetModule = "lineart"
	LineartCoarse          ControlNetModule = "lineart_coarse"
	LineartAnime           ControlNetModule = "lineart_anime"
	LineartStandard        ControlNetModule = "lineart_standard"
	Shuffle                ControlNetModule = "shuffle"
	TileResample           ControlNetModule = "tile_resample"
	Invert                 ControlNetModule = "invert"
	LineartAnimeDenoise    ControlNetModule = "lineart_anime_denoise"
	ReferenceOnly          ControlNetModule = "reference_only"
	ReferenceADAIN         ControlNetModule = "reference_adain"
	ReferenceADAINPlusAttn ControlNetModule = "reference_adain+attn"
	Inpaint                ControlNetModule = "inpaint"
	InpaintOnly            ControlNetModule = "inpaint_only"
	InpaintOnlyPlusLAMA    ControlNetModule = "inpaint_only+lama"
	TileColorFix           ControlNetModule = "tile_colorfix"
	TileColorFixPlusSharp  ControlNetModule = "tile_colorfix+sharp"
)

type ControlNetResizeMode

type ControlNetResizeMode int
const (
	JustResize    ControlNetResizeMode = 0
	CropAndResize ControlNetResizeMode = 1
	ResizeAndFill ControlNetResizeMode = 2
)

type ControlNetUnit

type ControlNetUnit struct {
	Model         string                `json:"model,omitempty"`
	Weight        float32               `json:"weight"`
	Module        ControlNetModule      `json:"module,omitempty"`
	InputImage    string                `json:"input_image,omitempty"`
	ControlMode   ControlNetControlMode `json:"control_mode"`
	ResizeMode    ControlNetResizeMode  `json:"resize_mode"`
	Mask          string                `json:"mask,omitempty"`
	ProcessorRes  int                   `json:"processor_res,omitempty"`
	ThresholdA    int                   `json:"threshold_a,omitempty"`
	ThresholdB    int                   `json:"threshold_b,omitempty"`
	GuidanceStart float32               `json:"guidance_start"`
	GuidanceEnd   float32               `json:"guidance_end"`
	PixelPerfect  bool                  `json:"pixel_perfect,omitempty"`
}

func NewControlNetUnit

func NewControlNetUnit(module ControlNetModule, model string, inputImage string) *ControlNetUnit

NewControlNetUnit Get default ControlNetUnit. Set value to default value in stable diffusion web ui. You can use this method to create ControlNetUnit if you don't know each meaning of value, then change the value you want to override.

type Img2ImgRequest

type Img2ImgRequest struct {
	ModelName              string            `json:"model_name,omitempty"`
	SamplerName            Sampler           `json:"sampler_name,omitempty"`
	InitImages             []string          `json:"init_images,omitempty"`
	Mask                   string            `json:"mask,omitempty"`
	ResizeMode             int               `json:"resize_mode,omitempty"`
	DenoisingStrength      float32           `json:"denoising_strength,omitempty"`
	CfgScale               float32           `json:"cfg_scale,omitempty"`
	MaskBlur               int               `json:"mask_blur,omitempty"`
	InpaintingFill         int               `json:"inpainting_fill,omitempty"`
	InpaintFullRes         int               `json:"inpaint_full_res,omitempty"`
	InpaintFullResPadding  int               `json:"inpaint_full_res_padding,omitempty"`
	InpaintMaskInvert      int               `json:"inpaint_mask_invert,omitempty"`
	InitialNoiseMultiplier float32           `json:"initial_noise_multiplier,omitempty"`
	Prompt                 string            `json:"prompt,omitempty"`
	Seed                   int64             `json:"seed,omitempty"`
	NegativePrompt         string            `json:"negative_prompt,omitempty"`
	BatchSize              int               `json:"batch_size,omitempty"`
	NIter                  int               `json:"n_iter,omitempty"`
	Steps                  int               `json:"steps,omitempty"`
	Width                  int               `json:"width,omitempty"`
	Height                 int               `json:"height,omitempty"`
	RestoreFaces           bool              `json:"restore_face,omitemptys"`
	SDVae                  string            `json:"sd_vae,omitempty"`
	ClipSkip               int               `json:"clip_skip,omitempty"`
	ControlNetUnits        []*ControlNetUnit `json:"controlnet_units,omitempty"`
}

func NewImg2ImgRequest

func NewImg2ImgRequest(prompt, negativePrompt, modelName string, initImage string) *Img2ImgRequest

NewImg2ImgRequest Get default Img2ImgRequest. Set value to default value in stable diffusion web ui. You can use this method to create Img2ImgRequest if you don't know each meaning of value, then change the value you want to override.

type Model

type Model struct {
	Name                         string          `json:"name"`
	Hash                         string          `json:"hash"`
	SdName                       string          `json:"sd_name"`
	ThirdSource                  string          `json:"third_source"`
	DownloadStatus               int             `json:"download_status"`
	DownloadName                 string          `json:"download_name"`
	DependencyStatus             int             `json:"dependency_status"`
	Type                         ModelType       `json:"type"`
	CivitaiLink                  string          `json:"civitai_link,omitempty"`
	CivitaiModelId               int             `json:"civitai_model_id,omitempty"`
	CivitaiVersionId             int             `json:"civitai_version_id,omitempty"`
	CivitaiNsfw                  bool            `json:"civitai_nsfw"`
	CivitaiImages                []*CivitaiImage `json:"civitai_images,omitempty"`
	CivitaiDownloadUrl           string          `json:"civitai_download_url,omitempty"`
	CivitaiAllowCommercialUse    string          `json:"civitai_allow_commercial_use,omitempty"`
	CivitaiAllowDifferentLicense bool            `json:"civitai_allow_different_license"`
	CivitaiCreateAt              string          `json:"civitai_create_at,omitempty"`
	CivitaiUpdateAt              string          `json:"civitai_update_at,omitempty"`
	CivitaiTrainedWords          string          `json:"civitai_trained_words,omitempty"`
	CivitaiTags                  string          `json:"civitai_tags,omitempty"`
	CivitaiDownloadCount         int64           `json:"civitai_download_count,omitempty"`
	CivitaiFavoriteCount         int64           `json:"civitai_favorite_count,omitempty"`
	CivitaiCommentCount          int64           `json:"civitai_comment_count,omitempty"`
	CivitaiRatingCount           int64           `json:"civitai_rating_count,omitempty"`
	CivitaiRating                float32         `json:"civitai_rating,omitempty"`
	CivitaiDependencyVersionId   int64           `json:"civitai_dependency_version_id,omitempty"`
	CivitaiDependencyModelName   string          `json:"civitai_dependency_model_name,omitempty"`
	CivitaiImageUrl              string          `json:"civitai_image_url,omitempty"`
	CivitaiImageNsfw             string          `json:"civitai_image_nsfw,omitempty"`
	CivitaiOriginImageUrl        string          `json:"civitai_origin_image_url,omitempty"`
	CivitaiImagePrompt           string          `json:"civitai_image_prompt,omitempty"`
	CivitaiImageNegativePrompt   string          `json:"civitai_image_negative_prompt,omitempty"`
	CivitaiImageSamplerName      string          `json:"civitai_image_sampler_name,omitempty"`
	CivitaiImageHeight           int             `json:"civitai_image_height,omitempty"`
	CivitaiImageWidth            int             `json:"civitai_image_width,omitempty"`
	CivitaiImageSteps            int             `json:"civitai_image_steps,omitempty"`
	CivitaiImageCfgScale         float32         `json:"civitai_image_cfg_scale,omitempty"`
	CivitaiImageSeed             int64           `json:"civitai_image_seed,omitempty"`
}

type ModelData

type ModelData struct {
	Models []*Model `json:"models"`
}

type ModelList

type ModelList []*Model

func (ModelList) FilterCivitaiVersionId

func (m ModelList) FilterCivitaiVersionId(civitaiVersionId int) *Model

func (ModelList) FilterNsfw

func (m ModelList) FilterNsfw(nsfw bool) ModelList

func (ModelList) FilterType

func (m ModelList) FilterType(typ ModelType) ModelList

func (ModelList) TopN

func (m ModelList) TopN(n int, valueFn func(m *Model) float32) ModelList

type ModelRequest

type ModelRequest struct {
}

type ModelType

type ModelType string
const (
	Checkpoint    ModelType = "checkpoint"
	Lora          ModelType = "lora"
	VAE           ModelType = "vae"
	ControlNet    ModelType = "controlnet"
	TextInversion ModelType = "textualinversion"
	Upscaler      ModelType = "upscaler"
)

type ModelsResponse

type ModelsResponse struct {
	Code int        `json:"code"`
	Msg  string     `json:"msg"`
	Data *ModelData `json:"data"`
}

func (ModelsResponse) GetCode

func (m ModelsResponse) GetCode() int

func (ModelsResponse) GetMsg

func (m ModelsResponse) GetMsg() string

type ProgressData

type ProgressData struct {
	Status        ProgressResponseStatusCode `json:"status"`
	Progress      float32                    `json:"progress"`
	ETARelative   float64                    `json:"eta_relative"`
	Imgs          []string                   `json:"imgs"`
	FailedReason  string                     `json:"failed_reason"`
	CurrentImages []string                   `json:"current_images"`
	SubmitTime    string                     `json:"submit_time"`
	ExecutionTime string                     `json:"execution_time"`
	Txt2ImgTime   string                     `json:"txt2img_time"`
	FinishTime    string                     `json:"finish_time"`
	ImgsBytes     [][]byte
}

func (*ProgressData) DownloadImages

func (p *ProgressData) DownloadImages(ctx context.Context) error

type ProgressRequest

type ProgressRequest struct {
	TaskId string `json:"task_id"`
}

type ProgressResponse

type ProgressResponse struct {
	Code int           `json:"code"`
	Msg  string        `json:"msg"`
	Data *ProgressData `json:"data"`
}

func (ProgressResponse) GetCode

func (p ProgressResponse) GetCode() int

func (ProgressResponse) GetMsg

func (p ProgressResponse) GetMsg() string

type ProgressResponseStatusCode

type ProgressResponseStatusCode int

func (ProgressResponseStatusCode) IsFinish

func (p ProgressResponseStatusCode) IsFinish() bool

type Sampler

type Sampler string
const (
	EulerA         Sampler = "Euler a"
	Euler          Sampler = "Euler"
	LMS            Sampler = "LMS"
	HEUN           Sampler = "Heun"
	DPM2           Sampler = "DPM2"
	DPM2A          Sampler = "DPM2 a"
	DPM2Karras     Sampler = "DPM2 Karras"
	DPM2AKarras    Sampler = "DPM2 a Karras"
	DPMPPSA        Sampler = "DPM++ 2S a"
	DPMPPM         Sampler = "DPM++ 2M"
	DPMPPSDE       Sampler = "DPM++ SDE"
	DPMPPKarras    Sampler = "DPM++ Karras"
	DPMPPSAKarras  Sampler = "DPM++ 2S a Karras"
	DPMPPMKarras   Sampler = "DPM++ 2M Karras"
	DPMPPSDEKarras Sampler = "DPM++ SDE Karras"
	DDIM           Sampler = "DDIM"
	PLMS           Sampler = "PLMS"
	UNIPC          Sampler = "UniPC"
	FlowMatchEuler Sampler = "FlowMatchEuler"
)

type Txt2ImgRequest

type Txt2ImgRequest struct {
	Prompt          string            `json:"prompt,omitempty"`
	NegativePrompt  string            `json:"negative_prompt,omitempty"`
	ModelName       string            `json:"model_name,omitempty"`
	SamplerName     Sampler           `json:"sampler_name,omitempty"`
	BatchSize       int               `json:"batch_size,omitempty"`
	NIter           int               `json:"n_iter,omitempty"`
	Steps           int               `json:"steps,omitempty"`
	CfgScale        float32           `json:"cfg_scale,omitempty"`
	Height          int               `json:"height,omitempty"`
	Width           int               `json:"width,omitempty"`
	Seed            int64             `json:"seed"`
	RestoreFaces    bool              `json:"restore_faces,omitempty"`
	SDVae           string            `json:"sd_vae,omitempty"`
	ClipSkip        int               `json:"clip_skip,omitempty"`
	EnableHr        bool              `json:"enable_hr,omitempty"`
	HrUpscaler      string            `json:"hr_upscaler,omitempty"`
	HrScale         float32           `json:"hr_scale,omitempty"`
	HrResizeX       int               `json:"hr_resize_x,omitempty"`
	HrResizeY       int               `json:"hr_resize_y,omitempty"`
	ControlNetUnits []*ControlNetUnit `json:"controlnet_units,omitempty"`
}

func NewTxt2ImgRequest

func NewTxt2ImgRequest(prompt, negativePrompt, modelName string) *Txt2ImgRequest

NewTxt2ImgRequest Get default Txt2ImgRequest. Set value to default value in stable diffusion web ui. You can use this method to create Txt2ImgRequest if you don't know each meaning of value, then change the value you want to override.

type UpscaleRequest

type UpscaleRequest struct {
	Image                     string            `json:"image"`
	ResizeMode                UpscaleResizeMode `json:"resize_mode"`
	UpscalingResize           float32           `json:"upscaling_resize,omitempty"`
	UpscalingResizeW          int               `json:"upscaling_resize_w,omitempty"`
	UpscalingResizeH          int               `json:"upscaling_resize_h,omitempty"`
	UpscalingCrop             bool              `json:"upscaling_crop"`
	Upscaler1                 string            `json:"upscaler_1"`
	Upscaler2                 string            `json:"upscaler_2"`
	ExtrasUpscaler2Visibility float32           `json:"extras_upscaler_2_visibility"`
	GfpganVisibility          float32           `json:"gfpgan_visibility"`
	CodeformerVisibility      float32           `json:"codeformer_visibility"`
	CodeformerWeight          float32           `json:"codeformer_weight"`
}

func NewUpscaleRequest

func NewUpscaleRequest(image string, upscalingResize float32) *UpscaleRequest

NewUpscaleRequest Get default UpscaleRequest. Set value to default value in stable diffusion web ui. You can use this method to create UpscaleRequest if you don't know each meaning of value, then change the value you want to override.

type UpscaleResizeMode

type UpscaleResizeMode int
const (
	UpscaleBy UpscaleResizeMode = 0
	UpscaleTo UpscaleResizeMode = 1
)

Jump to

Keyboard shortcuts

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