Documentation ¶
Index ¶
- func DecodeBase64(input string) ([]byte, error)
- func Init(logger *zap.Logger) base.IConnector
- type Client
- type Connector
- type Engine
- type Execution
- type HTTPClient
- type Image
- type ImageTaskRes
- type ImageToImageInput
- type ImageToImageOutput
- type ImageToImageReq
- type TextPrompt
- type TextToImageInput
- type TextToImageOutput
- type TextToImageReq
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeBase64 ¶
decode if the string is base64 encoded
Types ¶
type Client ¶
type Client struct { APIKey string HTTPClient HTTPClient }
Client represents a Stability AI client
func (*Client) GenerateImageFromImage ¶
func (c *Client) GenerateImageFromImage(req ImageToImageReq, engine string) (results []Image, err error)
GenerateImageFromImage makes a call to the image-to-image API from Stability AI. https://platform.stability.ai/rest-api#tag/v1generation/operation/imageToImage
func (*Client) GenerateImageFromText ¶
func (c *Client) GenerateImageFromText(params TextToImageReq, engine string) (results []Image, err error)
GenerateImageFromText makes a call to the text-to-image API from Stability AI. https://platform.stability.ai/rest-api#tag/v1generation/operation/textToImage
func (*Client) ListEngines ¶
ListEngines calls the list engine endpoint and returns the available engines. https://platform.stability.ai/rest-api#tag/v1engines/operation/listEngines
type Connector ¶
func (*Connector) CreateExecution ¶
type Engine ¶
type Engine struct { Description string `json:"description"` ID string `json:"id"` Name string `json:"name"` Type string `json:"type"` }
Engine represents a Stability AI Engine
type HTTPClient ¶
HTTPClient interface
type Image ¶
type Image struct { Base64 string `json:"base64"` Seed uint32 `json:"seed"` FinishReason string `json:"finishReason"` }
Image represents a single image
type ImageTaskRes ¶
type ImageTaskRes struct {
Images []Image `json:"artifacts"`
}
ImageTaskRes represents the response body for text-to-image API
type ImageToImageInput ¶
type ImageToImageInput struct { Task string `json:"task"` Engine string `json:"engine"` Prompts []string `json:"prompts"` InitImage string `json:"init_image"` Weights *[]float64 `json:"weights,omitempty"` InitImageMode *string `json:"init_image_mode,omitempty"` ImageStrength *float64 `json:"image_strength,omitempty"` StepScheduleStart *float64 `json:"step_schedule_start,omitempty"` StepScheduleEnd *float64 `json:"step_schedule_end,omitempty"` CfgScale *float64 `json:"cfg_scale,omitempty"` ClipGuidancePreset *string `json:"clip_guidance_preset,omitempty"` Sampler *string `json:"sampler,omitempty"` Samples *uint32 `json:"samples,omitempty"` Seed *uint32 `json:"seed,omitempty"` Steps *uint32 `json:"steps,omitempty"` StylePreset *string `json:"style_preset,omitempty"` }
type ImageToImageOutput ¶
type ImageToImageReq ¶
type ImageToImageReq struct { TextPrompts []TextPrompt `json:"text_prompts" om:"texts[:]"` InitImage string `json:"init_image" om:"images[0]"` CFGScale *float64 `json:"cfg_scale,omitempty" om:"metadata.cfg_scale"` ClipGuidancePreset *string `json:"clip_guidance_preset,omitempty" om:"metadata.clip_guidance_preset"` Sampler *string `json:"sampler,omitempty" om:"metadata.sampler"` Samples *uint32 `json:"samples,omitempty" om:"metadata.samples"` Seed *uint32 `json:"seed,omitempty" om:"metadata.seed"` Steps *uint32 `json:"steps,omitempty" om:"metadata.steps"` StylePreset *string `json:"style_preset,omitempty" om:"metadata.style_preset"` InitImageMode *string `json:"init_image_mode,omitempty" om:"metadata.init_image_mode"` ImageStrength *float64 `json:"image_strength,omitempty" om:"metadata.image_strength"` StepScheduleStart *float64 `json:"step_schedule_start,omitempty" om:"metadata.step_schedule_start"` StepScheduleEnd *float64 `json:"step_schedule_end,omitempty" om:"metadata.step_schedule_end"` }
ImageToImageReq represents the request body for image-to-image API
type TextPrompt ¶
TextPrompt holds a prompt's text and its weight.
type TextToImageInput ¶
type TextToImageInput struct { Task string `json:"task"` Prompts []string `json:"prompts"` Engine string `json:"engine"` Weights *[]float64 `json:"weights,omitempty"` Height *uint32 `json:"height,omitempty"` Width *uint32 `json:"width,omitempty"` CfgScale *float64 `json:"cfg_scale,omitempty"` ClipGuidancePreset *string `json:"clip_guidance_preset,omitempty"` Sampler *string `json:"sampler,omitempty"` Samples *uint32 `json:"samples,omitempty"` Seed *uint32 `json:"seed,omitempty"` Steps *uint32 `json:"steps,omitempty"` StylePreset *string `json:"style_preset,omitempty"` }
type TextToImageOutput ¶
type TextToImageReq ¶
type TextToImageReq struct { TextPrompts []TextPrompt `json:"text_prompts" om:"texts[:]"` CFGScale *float64 `json:"cfg_scale,omitempty" om:"metadata.cfg_scale"` ClipGuidancePreset *string `json:"clip_guidance_preset,omitempty" om:"metadata.clip_guidance_preset"` Sampler *string `json:"sampler,omitempty" om:"metadata.sampler"` Samples *uint32 `json:"samples,omitempty" om:"metadata.samples"` Seed *uint32 `json:"seed,omitempty" om:"metadata.seed"` Steps *uint32 `json:"steps,omitempty" om:"metadata.steps"` StylePreset *string `json:"style_preset,omitempty" om:"metadata.style_preset"` Height *uint32 `json:"height,omitempty" om:"metadata.height"` Width *uint32 `json:"width,omitempty" om:"metadata.width"` }
TextToImageReq represents the request body for text-to-image API