Documentation ¶
Overview ¶
Package fusionbrain - The Fusion Brain API. Documentation: https://fusionbrain.ai/docs/en/doc/api-dokumentaciya/
Index ¶
- Constants
- type FusionBrain
- func (f *FusionBrain) CheckAvailable(ctx context.Context) error
- func (f *FusionBrain) CheckStatus(ctx context.Context, uuid string) (GenerationStatus, error)
- func (f *FusionBrain) GetModels(ctx context.Context) ([]Model, error)
- func (f *FusionBrain) GetStyles(ctx context.Context) ([]Style, error)
- func (f *FusionBrain) TextToImage(ctx context.Context, reqBody RequestBody, modelID int) (string, error)
- type GenerationStatus
- type Model
- type RequestBody
- type Style
Constants ¶
const ( // StatusInitial - the request has been received, is in the queue for processing StatusInitial = "INITIAL" // StatusProcessing - the request is being processed StatusProcessing = "PROCESSING" // StatusDone - task completed StatusDone = "DONE" // StatusFail - the task could not be completed StatusFail = "FAIL" // StatusDisabledByQueue - service internal error StatusDisabledByQueue = "DISABLED_BY_QUEUE" )
The Fusion Brain statuses
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FusionBrain ¶
type FusionBrain struct {
// contains filtered or unexported fields
}
func NewFusionBrain ¶
func NewFusionBrain(client *fasthttp.Client, key, secretKey string) *FusionBrain
NewFusionBrain - the Fusion Brain API is a new section of the platform that allows platform users to access artificial intelligence models via the API. One of the first models that is available via the API is the Kandinsky model.
func (*FusionBrain) CheckAvailable ¶
func (f *FusionBrain) CheckAvailable(ctx context.Context) error
CheckAvailable - if there is a heavy load or technical work, the service may be temporarily unavailable to accept new tasks. You can check the current status in advance by using a GET request to URL /key/api/v1/text2image/availability. During unavailability, tasks will not be accepted and in response to a request to the model, instead of the uuid of your task, the current status of the service will be returned.
func (*FusionBrain) CheckStatus ¶
func (f *FusionBrain) CheckStatus(ctx context.Context, uuid string) (GenerationStatus, error)
CheckStatus - The check_status request allows you to check the status of image generation. To call this method, you need to send a GET request to the URL запрос на URL /key/api/v1/text2image/status/{uuid}, where uid is the task ID received when calling the request to the model.
func (*FusionBrain) GetModels ¶
func (f *FusionBrain) GetModels(ctx context.Context) ([]Model, error)
GetModels - list of available models. The appeal takes place at the URL: https://api-key.fusionbrain.ai/key/api/v1/models.
func (*FusionBrain) GetStyles ¶
func (f *FusionBrain) GetStyles(ctx context.Context) ([]Style, error)
GetStyles - getting the current list of styles.
func (*FusionBrain) TextToImage ¶
func (f *FusionBrain) TextToImage(ctx context.Context, reqBody RequestBody, modelID int) (string, error)
TextToImage - the generate mode takes a text description of an image as input and generates an image corresponding to it. To call this method, you need to send a POST request to the URL /key/api/v1/text2image/run.