Documentation
¶
Index ¶
- Constants
- type Client
- func (c *Client) Img2Img(ctx context.Context, request *types.Img2ImgRequest) (*types.AsyncResponse, error)
- func (c *Client) Models(ctx context.Context, opts ...WithModelOption) (types.ModelList, error)
- func (c *Client) Progress(ctx context.Context, request *types.ProgressRequest, ...) (*types.ProgressResponse, error)
- func (c *Client) SyncImg2img(ctx context.Context, request *types.Img2ImgRequest, ...) (*types.ProgressResponse, error)
- func (c *Client) SyncTxt2img(ctx context.Context, request *types.Txt2ImgRequest, ...) (*types.ProgressResponse, error)
- func (c *Client) SyncUpscale(ctx context.Context, request *types.UpscaleRequest, ...) (*types.ProgressResponse, error)
- func (c *Client) Txt2Img(ctx context.Context, request *types.Txt2ImgRequest) (*types.AsyncResponse, error)
- func (c *Client) Upscale(ctx context.Context, request *types.UpscaleRequest) (*types.AsyncResponse, error)
- type ClientInterface
- type GenerateImageOption
- type ModelOption
- type WithGenerateImageOption
- type WithModelOption
Constants ¶
View Source
const BaseURL = "https://api.novita.ai/v3"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) Img2Img ¶
func (c *Client) Img2Img(ctx context.Context, request *types.Img2ImgRequest) (*types.AsyncResponse, error)
func (*Client) Progress ¶
func (c *Client) Progress(ctx context.Context, request *types.ProgressRequest, opts ...WithGenerateImageOption) (*types.ProgressResponse, error)
func (*Client) SyncImg2img ¶
func (c *Client) SyncImg2img(ctx context.Context, request *types.Img2ImgRequest, opts ...WithGenerateImageOption) (*types.ProgressResponse, error)
func (*Client) SyncTxt2img ¶
func (c *Client) SyncTxt2img(ctx context.Context, request *types.Txt2ImgRequest, opts ...WithGenerateImageOption) (*types.ProgressResponse, error)
func (*Client) SyncUpscale ¶
func (c *Client) SyncUpscale(ctx context.Context, request *types.UpscaleRequest, opts ...WithGenerateImageOption) (*types.ProgressResponse, error)
func (*Client) Txt2Img ¶
func (c *Client) Txt2Img(ctx context.Context, request *types.Txt2ImgRequest) (*types.AsyncResponse, error)
func (*Client) Upscale ¶
func (c *Client) Upscale(ctx context.Context, request *types.UpscaleRequest) (*types.AsyncResponse, error)
type ClientInterface ¶
type ClientInterface interface {
// Txt2Img Asynchronously generate images from request. Returns AsyncResponse, use `task_id` to get Progress.
Txt2Img(context.Context, *types.Txt2ImgRequest) (*types.AsyncResponse, error)
// SyncTxt2img Synchronously generate images from request. You can get image url in `Progress.Data.Imgs`.
SyncTxt2img(context.Context, *types.Txt2ImgRequest, ...WithGenerateImageOption) (*types.ProgressResponse, error)
// Img2Img Asynchronously generate images from request. Returns AsyncResponse, use `task_id` to get Progress.
Img2Img(context.Context, *types.Img2ImgRequest) (*types.AsyncResponse, error)
// SyncImg2img Synchronously generate images from request. You can get image url in `Progress.Data.Imgs`.
SyncImg2img(context.Context, *types.Img2ImgRequest, ...WithGenerateImageOption) (*types.ProgressResponse, error)
// Progress Task Progress, use `task_id` to get progress.
Progress(context.Context, *types.ProgressRequest, ...WithGenerateImageOption) (*types.ProgressResponse, error)
// Upscale Asynchronously upscale images from request. Returns AsyncResponse, use `task_id` to get Progress.
Upscale(context.Context, *types.Img2ImgRequest) (*types.AsyncResponse, error)
// SyncUpscale Synchronously upscale images from request. You can get image url in `Progress.Data.Imgs`.
SyncUpscale(context.Context, *types.Img2ImgRequest, ...WithGenerateImageOption) (*types.ProgressResponse, error)
// Models List all models, including checkpoint, lora, vae and other models. Return types info by type.
Models(context.Context, ...WithModelOption) (map[types.ModelType]*types.Model, error)
}
ClientInterface define the behavior of Client
type GenerateImageOption ¶
type GenerateImageOption struct {
DownloadImage bool
SaveImage bool
SaveImageDir string
SaveImagePerm os.FileMode
SaveImageFileNameConverter func(taskId string, fileIndex int, fileName string) string
}
GenerateImageOption Generation Option
type ModelOption ¶
type ModelOption struct {
Refresh bool
}
type WithGenerateImageOption ¶
type WithGenerateImageOption func(*GenerateImageOption)
WithGenerateImageOption Option Pattern
func WithDownloadImage ¶
func WithDownloadImage() WithGenerateImageOption
WithDownloadImage if this is set, you can get image raw bytes in `Progress.Data.ImgsBytes`
func WithSaveImage ¶
type WithModelOption ¶
type WithModelOption func(opt *ModelOption)
func WithRefresh ¶
func WithRefresh() WithModelOption
Click to show internal directories.
Click to hide internal directories.