stabilityai

package
v0.14.0-beta Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(logger *zap.Logger) base.IConnector

Types

type Connector

type Connector struct {
	base.Connector
}

func (*Connector) CreateExecution

func (c *Connector) CreateExecution(defUID uuid.UUID, task string, config *structpb.Struct, logger *zap.Logger) (base.IExecution, error)

func (*Connector) Test

func (c *Connector) Test(_ uuid.UUID, config *structpb.Struct, logger *zap.Logger) (pipelinePB.Connector_State, error)

Test checks the connector state.

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 Execution

type Execution struct {
	base.Execution
}

func (*Execution) Execute

func (e *Execution) Execute(inputs []*structpb.Struct) ([]*structpb.Struct, error)

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 ImageToImageOutput struct {
	Images []string `json:"images"`
	Seeds  []uint32 `json:"seeds"`
}

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"`
	// contains filtered or unexported fields
}

ImageToImageReq represents the request body for image-to-image API

type TextPrompt

type TextPrompt struct {
	Text   string   `json:"text" om:"."`
	Weight *float64 `json:"weight"`
}

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 TextToImageOutput struct {
	Images []string `json:"images"`
	Seeds  []uint32 `json:"seeds"`
}

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"`
	// contains filtered or unexported fields
}

TextToImageReq represents the request body for text-to-image API

Jump to

Keyboard shortcuts

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