Documentation
¶
Overview ¶
Package worker's module provides multipart form data utilities.
This module extends oapi-codegen Go bindings with multipart writers, enabling request parameter encoding for inter-node communication (gateway, orchestrator, runner).
Package worker provides primitives to interact with the openapi HTTP API.
Code generated by github.com/deepmap/oapi-codegen/v2 version v2.2.0 DO NOT EDIT.
Index ¶
- Constants
- func GetSwagger() (swagger *openapi3.T, err error)
- func Handler(si ServerInterface) http.Handler
- func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler
- func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler
- func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler
- func NewAudioToTextMultipartWriter(w io.Writer, req AudioToTextMultipartRequestBody) (*multipart.Writer, error)
- func NewAudioToTextRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
- func NewHealthRequest(server string) (*http.Request, error)
- func NewImageToImageMultipartWriter(w io.Writer, req ImageToImageMultipartRequestBody) (*multipart.Writer, error)
- func NewImageToImageRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
- func NewImageToVideoMultipartWriter(w io.Writer, req ImageToVideoMultipartRequestBody) (*multipart.Writer, error)
- func NewImageToVideoRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
- func NewSegmentAnything2MultipartWriter(w io.Writer, req SegmentAnything2MultipartRequestBody) (*multipart.Writer, error)
- func NewSegmentAnything2RequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
- func NewTextToImageRequest(server string, body TextToImageJSONRequestBody) (*http.Request, error)
- func NewTextToImageRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
- func NewUpscaleMultipartWriter(w io.Writer, req UpscaleMultipartRequestBody) (*multipart.Writer, error)
- func NewUpscaleRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
- func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)
- func ReadImageB64DataUrl(url string, w io.Writer) error
- func SaveImageB64DataUrl(url, outputPath string) error
- type APIError
- type AudioToTextMultipartRequestBody
- type AudioToTextResponse
- type BodyAudioToTextAudioToTextPost
- type BodyImageToImageImageToImagePost
- type BodyImageToVideoImageToVideoPost
- type BodySegmentAnything2SegmentAnything2Post
- type BodyUpscaleUpscalePost
- type ChiServerOptions
- type Chunk
- type Client
- func (c *Client) AudioToTextWithBody(ctx context.Context, contentType string, body io.Reader, ...) (*http.Response, error)
- func (c *Client) Health(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) ImageToImageWithBody(ctx context.Context, contentType string, body io.Reader, ...) (*http.Response, error)
- func (c *Client) ImageToVideoWithBody(ctx context.Context, contentType string, body io.Reader, ...) (*http.Response, error)
- func (c *Client) SegmentAnything2WithBody(ctx context.Context, contentType string, body io.Reader, ...) (*http.Response, error)
- func (c *Client) TextToImage(ctx context.Context, body TextToImageJSONRequestBody, ...) (*http.Response, error)
- func (c *Client) TextToImageWithBody(ctx context.Context, contentType string, body io.Reader, ...) (*http.Response, error)
- func (c *Client) UpscaleWithBody(ctx context.Context, contentType string, body io.Reader, ...) (*http.Response, error)
- type ClientInterface
- type ClientOption
- type ClientWithResponses
- func (c *ClientWithResponses) AudioToTextWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, ...) (*AudioToTextResponse, error)
- func (c *ClientWithResponses) HealthWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*HealthResponse, error)
- func (c *ClientWithResponses) ImageToImageWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, ...) (*ImageToImageResponse, error)
- func (c *ClientWithResponses) ImageToVideoWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, ...) (*ImageToVideoResponse, error)
- func (c *ClientWithResponses) SegmentAnything2WithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, ...) (*SegmentAnything2Response, error)
- func (c *ClientWithResponses) TextToImageWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, ...) (*TextToImageResponse, error)
- func (c *ClientWithResponses) TextToImageWithResponse(ctx context.Context, body TextToImageJSONRequestBody, ...) (*TextToImageResponse, error)
- func (c *ClientWithResponses) UpscaleWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, ...) (*UpscaleResponse, error)
- type ClientWithResponsesInterface
- type DockerManager
- func (m *DockerManager) Borrow(ctx context.Context, pipeline, modelID string) (*RunnerContainer, error)
- func (m *DockerManager) HasCapacity(ctx context.Context, pipeline, modelID string) bool
- func (m *DockerManager) Return(rc *RunnerContainer)
- func (m *DockerManager) Stop(ctx context.Context) error
- func (m *DockerManager) Warm(ctx context.Context, pipeline string, modelID string, ...) error
- type EnvValue
- type HTTPError
- type HTTPValidationError
- type HealthCheck
- type HealthResponse
- type HttpRequestDoer
- type ImageResponse
- type ImageToImageMultipartRequestBody
- type ImageToImageResponse
- type ImageToVideoMultipartRequestBody
- type ImageToVideoResponse
- type InvalidParamFormatError
- type MasksResponse
- type Media
- type MiddlewareFunc
- type OptimizationFlags
- type RequestEditorFn
- type RequiredHeaderError
- type RequiredParamError
- type RunnerContainer
- type RunnerContainerConfig
- type RunnerContainerType
- type RunnerEndpoint
- type SegmentAnything2MultipartRequestBody
- type SegmentAnything2Response
- type ServerInterface
- type ServerInterfaceWrapper
- func (siw *ServerInterfaceWrapper) AudioToText(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) Health(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) ImageToImage(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) ImageToVideo(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) SegmentAnything2(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) TextToImage(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) Upscale(w http.ResponseWriter, r *http.Request)
- type TextResponse
- type TextToImageJSONRequestBody
- type TextToImageParams
- type TextToImageResponse
- type TooManyValuesForParamError
- type UnescapedCookieParamError
- type Unimplemented
- func (_ Unimplemented) AudioToText(w http.ResponseWriter, r *http.Request)
- func (_ Unimplemented) Health(w http.ResponseWriter, r *http.Request)
- func (_ Unimplemented) ImageToImage(w http.ResponseWriter, r *http.Request)
- func (_ Unimplemented) ImageToVideo(w http.ResponseWriter, r *http.Request)
- func (_ Unimplemented) SegmentAnything2(w http.ResponseWriter, r *http.Request)
- func (_ Unimplemented) TextToImage(w http.ResponseWriter, r *http.Request)
- func (_ Unimplemented) Upscale(w http.ResponseWriter, r *http.Request)
- type UnmarshalingParamError
- type UpscaleMultipartRequestBody
- type UpscaleResponse
- type ValidationError
- type ValidationErrorLoc0
- type ValidationErrorLoc1
- type ValidationError_Loc_Item
- func (t ValidationError_Loc_Item) AsValidationErrorLoc0() (ValidationErrorLoc0, error)
- func (t ValidationError_Loc_Item) AsValidationErrorLoc1() (ValidationErrorLoc1, error)
- func (t *ValidationError_Loc_Item) FromValidationErrorLoc0(v ValidationErrorLoc0) error
- func (t *ValidationError_Loc_Item) FromValidationErrorLoc1(v ValidationErrorLoc1) error
- func (t ValidationError_Loc_Item) MarshalJSON() ([]byte, error)
- func (t *ValidationError_Loc_Item) MergeValidationErrorLoc0(v ValidationErrorLoc0) error
- func (t *ValidationError_Loc_Item) MergeValidationErrorLoc1(v ValidationErrorLoc1) error
- func (t *ValidationError_Loc_Item) UnmarshalJSON(b []byte) error
- type VideoResponse
- type Worker
- func (w *Worker) AudioToText(ctx context.Context, req AudioToTextMultipartRequestBody) (*TextResponse, error)
- func (w *Worker) HasCapacity(pipeline, modelID string) bool
- func (w *Worker) ImageToImage(ctx context.Context, req ImageToImageMultipartRequestBody) (*ImageResponse, error)
- func (w *Worker) ImageToVideo(ctx context.Context, req ImageToVideoMultipartRequestBody) (*VideoResponse, error)
- func (w *Worker) SegmentAnything2(ctx context.Context, req SegmentAnything2MultipartRequestBody) (*MasksResponse, error)
- func (w *Worker) Stop(ctx context.Context) error
- func (w *Worker) TextToImage(ctx context.Context, req TextToImageJSONRequestBody) (*ImageResponse, error)
- func (w *Worker) Upscale(ctx context.Context, req UpscaleMultipartRequestBody) (*ImageResponse, error)
- func (w *Worker) Warm(ctx context.Context, pipeline string, modelID string, endpoint RunnerEndpoint, ...) error
Constants ¶
const (
HTTPBearerScopes = "HTTPBearer.Scopes"
)
Variables ¶
This section is empty.
Functions ¶
func GetSwagger ¶
GetSwagger returns the Swagger specification corresponding to the generated code in this file. The external references of Swagger specification are resolved. The logic of resolving external references is tightly connected to "import-mapping" feature. Externally referenced files must be embedded in the corresponding golang packages. Urls can be supported but this task was out of the scope.
func Handler ¶
func Handler(si ServerInterface) http.Handler
Handler creates http.Handler with routing matching OpenAPI spec.
func HandlerFromMux ¶
func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler
HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux.
func HandlerWithOptions ¶
func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler
HandlerWithOptions creates http.Handler with additional options
func NewAudioToTextRequestWithBody ¶
func NewAudioToTextRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
NewAudioToTextRequestWithBody generates requests for AudioToText with any type of body
func NewHealthRequest ¶
NewHealthRequest generates requests for Health
func NewImageToImageRequestWithBody ¶
func NewImageToImageRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
NewImageToImageRequestWithBody generates requests for ImageToImage with any type of body
func NewImageToVideoRequestWithBody ¶
func NewImageToVideoRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
NewImageToVideoRequestWithBody generates requests for ImageToVideo with any type of body
func NewSegmentAnything2MultipartWriter ¶ added in v0.2.0
func NewSegmentAnything2RequestWithBody ¶ added in v0.2.0
func NewSegmentAnything2RequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
NewSegmentAnything2RequestWithBody generates requests for SegmentAnything2 with any type of body
func NewTextToImageRequest ¶
func NewTextToImageRequest(server string, body TextToImageJSONRequestBody) (*http.Request, error)
NewTextToImageRequest calls the generic TextToImage builder with application/json body
func NewTextToImageRequestWithBody ¶
func NewTextToImageRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
NewTextToImageRequestWithBody generates requests for TextToImage with any type of body
func NewUpscaleRequestWithBody ¶
func NewUpscaleRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
NewUpscaleRequestWithBody generates requests for Upscale with any type of body
func PathToRawSpec ¶
Constructs a synthetic filesystem for resolving external references when loading openapi specifications.
func SaveImageB64DataUrl ¶
Types ¶
type APIError ¶
type APIError struct {
// Msg The error message.
Msg string `json:"msg"`
}
APIError API error response model.
type AudioToTextMultipartRequestBody ¶
type AudioToTextMultipartRequestBody = BodyAudioToTextAudioToTextPost
AudioToTextMultipartRequestBody defines body for AudioToText for multipart/form-data ContentType.
type AudioToTextResponse ¶
type AudioToTextResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *TextResponse
JSON400 *HTTPError
JSON401 *HTTPError
JSON413 *HTTPError
JSON422 *HTTPValidationError
JSON500 *HTTPError
}
func ParseAudioToTextResponse ¶
func ParseAudioToTextResponse(rsp *http.Response) (*AudioToTextResponse, error)
ParseAudioToTextResponse parses an HTTP response from a AudioToTextWithResponse call
func (AudioToTextResponse) Status ¶
func (r AudioToTextResponse) Status() string
Status returns HTTPResponse.Status
func (AudioToTextResponse) StatusCode ¶
func (r AudioToTextResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type BodyAudioToTextAudioToTextPost ¶
type BodyAudioToTextAudioToTextPost struct {
// Audio Uploaded audio file to be transcribed.
Audio openapi_types.File `json:"audio"`
// ModelId Hugging Face model ID used for transcription.
ModelId *string `json:"model_id,omitempty"`
}
BodyAudioToTextAudioToTextPost defines model for Body_audio_to_text_audio_to_text_post.
type BodyImageToImageImageToImagePost ¶
type BodyImageToImageImageToImagePost struct {
// GuidanceScale Encourages model to generate images closely linked to the text prompt (higher values may reduce image quality).
GuidanceScale *float32 `json:"guidance_scale,omitempty"`
// Image Uploaded image to modify with the pipeline.
Image openapi_types.File `json:"image"`
// ImageGuidanceScale Degree to which the generated image is pushed towards the initial image.
ImageGuidanceScale *float32 `json:"image_guidance_scale,omitempty"`
// ModelId Hugging Face model ID used for image generation.
ModelId *string `json:"model_id,omitempty"`
// NegativePrompt Text prompt(s) to guide what to exclude from image generation. Ignored if guidance_scale < 1.
NegativePrompt *string `json:"negative_prompt,omitempty"`
// NumImagesPerPrompt Number of images to generate per prompt.
NumImagesPerPrompt *int `json:"num_images_per_prompt,omitempty"`
// NumInferenceSteps Number of denoising steps. More steps usually lead to higher quality images but slower inference. Modulated by strength.
NumInferenceSteps *int `json:"num_inference_steps,omitempty"`
// Prompt Text prompt(s) to guide image generation.
Prompt string `json:"prompt"`
// SafetyCheck Perform a safety check to estimate if generated images could be offensive or harmful.
SafetyCheck *bool `json:"safety_check,omitempty"`
// Seed Seed for random number generation.
Seed *int `json:"seed,omitempty"`
// Strength Degree of transformation applied to the reference image (0 to 1).
Strength *float32 `json:"strength,omitempty"`
}
BodyImageToImageImageToImagePost defines model for Body_image_to_image_image_to_image_post.
type BodyImageToVideoImageToVideoPost ¶
type BodyImageToVideoImageToVideoPost struct {
// Fps The frames per second of the generated video.
Fps *int `json:"fps,omitempty"`
// Height The height in pixels of the generated video.
Height *int `json:"height,omitempty"`
// Image Uploaded image to generate a video from.
Image openapi_types.File `json:"image"`
// ModelId Hugging Face model ID used for video generation.
ModelId *string `json:"model_id,omitempty"`
// MotionBucketId Used for conditioning the amount of motion for the generation. The higher the number the more motion will be in the video.
MotionBucketId *int `json:"motion_bucket_id,omitempty"`
// NoiseAugStrength Amount of noise added to the conditioning image. Higher values reduce resemblance to the conditioning image and increase motion.
NoiseAugStrength *float32 `json:"noise_aug_strength,omitempty"`
// NumInferenceSteps Number of denoising steps. More steps usually lead to higher quality images but slower inference. Modulated by strength.
NumInferenceSteps *int `json:"num_inference_steps,omitempty"`
// SafetyCheck Perform a safety check to estimate if generated images could be offensive or harmful.
SafetyCheck *bool `json:"safety_check,omitempty"`
// Seed Seed for random number generation.
Seed *int `json:"seed,omitempty"`
// Width The width in pixels of the generated video.
Width *int `json:"width,omitempty"`
}
BodyImageToVideoImageToVideoPost defines model for Body_image_to_video_image_to_video_post.
type BodySegmentAnything2SegmentAnything2Post ¶ added in v0.2.0
type BodySegmentAnything2SegmentAnything2Post struct {
// Box A length 4 array given as a box prompt to the model, in XYXY format.
Box *string `json:"box,omitempty"`
// Image Image to segment.
Image openapi_types.File `json:"image"`
// MaskInput A low-resolution mask input to the model, typically from a previous prediction iteration, with the form 1xHxW (H=W=256 for SAM).
MaskInput *string `json:"mask_input,omitempty"`
// ModelId Hugging Face model ID used for image generation.
ModelId *string `json:"model_id,omitempty"`
// MultimaskOutput If true, the model will return three masks for ambiguous input prompts, often producing better masks than a single prediction.
MultimaskOutput *bool `json:"multimask_output,omitempty"`
// NormalizeCoords If true, the point coordinates will be normalized to the range [0,1], with point_coords expected to be with respect to image dimensions.
NormalizeCoords *bool `json:"normalize_coords,omitempty"`
// PointCoords Nx2 array of point prompts to the model, where each point is in (X,Y) in pixels.
PointCoords *string `json:"point_coords,omitempty"`
// PointLabels Labels for the point prompts, where 1 indicates a foreground point and 0 indicates a background point.
PointLabels *string `json:"point_labels,omitempty"`
// ReturnLogits If true, returns un-thresholded mask logits instead of a binary mask.
ReturnLogits *bool `json:"return_logits,omitempty"`
}
BodySegmentAnything2SegmentAnything2Post defines model for Body_segment_anything_2_segment_anything_2_post.
type BodyUpscaleUpscalePost ¶
type BodyUpscaleUpscalePost struct {
// Image Uploaded image to modify with the pipeline.
Image openapi_types.File `json:"image"`
// ModelId Hugging Face model ID used for upscaled image generation.
ModelId *string `json:"model_id,omitempty"`
// NumInferenceSteps Number of denoising steps. More steps usually lead to higher quality images but slower inference. Modulated by strength.
NumInferenceSteps *int `json:"num_inference_steps,omitempty"`
// Prompt Text prompt(s) to guide upscaled image generation.
Prompt string `json:"prompt"`
// SafetyCheck Perform a safety check to estimate if generated images could be offensive or harmful.
SafetyCheck *bool `json:"safety_check,omitempty"`
// Seed Seed for random number generation.
Seed *int `json:"seed,omitempty"`
}
BodyUpscaleUpscalePost defines model for Body_upscale_upscale_post.
type ChiServerOptions ¶
type ChiServerOptions struct {
BaseURL string
BaseRouter chi.Router
Middlewares []MiddlewareFunc
ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}
type Chunk ¶
type Chunk struct {
// Text The text of the chunk.
Text string `json:"text"`
// Timestamp The timestamp of the chunk.
Timestamp []interface{} `json:"timestamp"`
}
Chunk A chunk of text with a timestamp.
type Client ¶
type Client struct {
// The endpoint of the server conforming to this interface, with scheme,
// https://api.deepmap.com for example. This can contain a path relative
// to the server, such as https://api.deepmap.com/dev-test, and all the
// paths in the swagger spec will be appended to the server.
Server string
// Doer for performing requests, typically a *http.Client with any
// customized settings, such as certificate chains.
Client HttpRequestDoer
// A list of callbacks for modifying requests which are generated before sending over
// the network.
RequestEditors []RequestEditorFn
}
Client which conforms to the OpenAPI3 specification for this service.
func NewClient ¶
func NewClient(server string, opts ...ClientOption) (*Client, error)
Creates a new Client, with reasonable defaults
func (*Client) AudioToTextWithBody ¶
func (*Client) ImageToImageWithBody ¶
func (*Client) ImageToVideoWithBody ¶
func (*Client) SegmentAnything2WithBody ¶ added in v0.2.0
func (*Client) TextToImage ¶
func (c *Client) TextToImage(ctx context.Context, body TextToImageJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
func (*Client) TextToImageWithBody ¶
type ClientInterface ¶
type ClientInterface interface {
// AudioToTextWithBody request with any body
AudioToTextWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
// Health request
Health(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
// ImageToImageWithBody request with any body
ImageToImageWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
// ImageToVideoWithBody request with any body
ImageToVideoWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
// SegmentAnything2WithBody request with any body
SegmentAnything2WithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
// TextToImageWithBody request with any body
TextToImageWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
TextToImage(ctx context.Context, body TextToImageJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
// UpscaleWithBody request with any body
UpscaleWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
}
The interface specification for the client above.
type ClientOption ¶
ClientOption allows setting custom parameters during construction
func WithHTTPClient ¶
func WithHTTPClient(doer HttpRequestDoer) ClientOption
WithHTTPClient allows overriding the default Doer, which is automatically created using http.Client. This is useful for tests.
func WithRequestEditorFn ¶
func WithRequestEditorFn(fn RequestEditorFn) ClientOption
WithRequestEditorFn allows setting up a callback function, which will be called right before sending the request. This can be used to mutate the request.
type ClientWithResponses ¶
type ClientWithResponses struct {
ClientInterface
}
ClientWithResponses builds on ClientInterface to offer response payloads
func NewClientWithResponses ¶
func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error)
NewClientWithResponses creates a new ClientWithResponses, which wraps Client with return type handling
func (*ClientWithResponses) AudioToTextWithBodyWithResponse ¶
func (c *ClientWithResponses) AudioToTextWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*AudioToTextResponse, error)
AudioToTextWithBodyWithResponse request with arbitrary body returning *AudioToTextResponse
func (*ClientWithResponses) HealthWithResponse ¶
func (c *ClientWithResponses) HealthWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*HealthResponse, error)
HealthWithResponse request returning *HealthResponse
func (*ClientWithResponses) ImageToImageWithBodyWithResponse ¶
func (c *ClientWithResponses) ImageToImageWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ImageToImageResponse, error)
ImageToImageWithBodyWithResponse request with arbitrary body returning *ImageToImageResponse
func (*ClientWithResponses) ImageToVideoWithBodyWithResponse ¶
func (c *ClientWithResponses) ImageToVideoWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ImageToVideoResponse, error)
ImageToVideoWithBodyWithResponse request with arbitrary body returning *ImageToVideoResponse
func (*ClientWithResponses) SegmentAnything2WithBodyWithResponse ¶ added in v0.2.0
func (c *ClientWithResponses) SegmentAnything2WithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SegmentAnything2Response, error)
SegmentAnything2WithBodyWithResponse request with arbitrary body returning *SegmentAnything2Response
func (*ClientWithResponses) TextToImageWithBodyWithResponse ¶
func (c *ClientWithResponses) TextToImageWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*TextToImageResponse, error)
TextToImageWithBodyWithResponse request with arbitrary body returning *TextToImageResponse
func (*ClientWithResponses) TextToImageWithResponse ¶
func (c *ClientWithResponses) TextToImageWithResponse(ctx context.Context, body TextToImageJSONRequestBody, reqEditors ...RequestEditorFn) (*TextToImageResponse, error)
func (*ClientWithResponses) UpscaleWithBodyWithResponse ¶
func (c *ClientWithResponses) UpscaleWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpscaleResponse, error)
UpscaleWithBodyWithResponse request with arbitrary body returning *UpscaleResponse
type ClientWithResponsesInterface ¶
type ClientWithResponsesInterface interface {
// AudioToTextWithBodyWithResponse request with any body
AudioToTextWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*AudioToTextResponse, error)
// HealthWithResponse request
HealthWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*HealthResponse, error)
// ImageToImageWithBodyWithResponse request with any body
ImageToImageWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ImageToImageResponse, error)
// ImageToVideoWithBodyWithResponse request with any body
ImageToVideoWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ImageToVideoResponse, error)
// SegmentAnything2WithBodyWithResponse request with any body
SegmentAnything2WithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SegmentAnything2Response, error)
// TextToImageWithBodyWithResponse request with any body
TextToImageWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*TextToImageResponse, error)
TextToImageWithResponse(ctx context.Context, body TextToImageJSONRequestBody, reqEditors ...RequestEditorFn) (*TextToImageResponse, error)
// UpscaleWithBodyWithResponse request with any body
UpscaleWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpscaleResponse, error)
}
ClientWithResponsesInterface is the interface specification for the client with responses above.
type DockerManager ¶
type DockerManager struct {
// contains filtered or unexported fields
}
func NewDockerManager ¶
func NewDockerManager(defaultImage string, gpus []string, modelDir string) (*DockerManager, error)
func (*DockerManager) Borrow ¶
func (m *DockerManager) Borrow(ctx context.Context, pipeline, modelID string) (*RunnerContainer, error)
func (*DockerManager) HasCapacity ¶
func (m *DockerManager) HasCapacity(ctx context.Context, pipeline, modelID string) bool
HasCapacity checks if an unused managed container exists or if a GPU is available for a new container.
func (*DockerManager) Return ¶
func (m *DockerManager) Return(rc *RunnerContainer)
func (*DockerManager) Warm ¶
func (m *DockerManager) Warm(ctx context.Context, pipeline string, modelID string, optimizationFlags OptimizationFlags) error
type EnvValue ¶
type EnvValue string
EnvValue unmarshals JSON booleans as strings for compatibility with env variables.
func (*EnvValue) UnmarshalJSON ¶
UnmarshalJSON converts JSON booleans to strings for EnvValue.
type HTTPError ¶
type HTTPError struct {
// Detail Detailed error information.
Detail APIError `json:"detail"`
}
HTTPError HTTP error response model.
type HTTPValidationError ¶
type HTTPValidationError struct {
Detail *[]ValidationError `json:"detail,omitempty"`
}
HTTPValidationError defines model for HTTPValidationError.
type HealthCheck ¶
type HealthCheck struct {
Status *string `json:"status,omitempty"`
}
HealthCheck defines model for HealthCheck.
type HealthResponse ¶
type HealthResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *HealthCheck
}
func ParseHealthResponse ¶
func ParseHealthResponse(rsp *http.Response) (*HealthResponse, error)
ParseHealthResponse parses an HTTP response from a HealthWithResponse call
func (HealthResponse) Status ¶
func (r HealthResponse) Status() string
Status returns HTTPResponse.Status
func (HealthResponse) StatusCode ¶
func (r HealthResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type HttpRequestDoer ¶
Doer performs HTTP requests.
The standard http.Client implements this interface.
type ImageResponse ¶
type ImageResponse struct {
// Images The generated images.
Images []Media `json:"images"`
}
ImageResponse Response model for image generation.
type ImageToImageMultipartRequestBody ¶
type ImageToImageMultipartRequestBody = BodyImageToImageImageToImagePost
ImageToImageMultipartRequestBody defines body for ImageToImage for multipart/form-data ContentType.
type ImageToImageResponse ¶
type ImageToImageResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ImageResponse
JSON400 *HTTPError
JSON401 *HTTPError
JSON422 *HTTPValidationError
JSON500 *HTTPError
}
func ParseImageToImageResponse ¶
func ParseImageToImageResponse(rsp *http.Response) (*ImageToImageResponse, error)
ParseImageToImageResponse parses an HTTP response from a ImageToImageWithResponse call
func (ImageToImageResponse) Status ¶
func (r ImageToImageResponse) Status() string
Status returns HTTPResponse.Status
func (ImageToImageResponse) StatusCode ¶
func (r ImageToImageResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type ImageToVideoMultipartRequestBody ¶
type ImageToVideoMultipartRequestBody = BodyImageToVideoImageToVideoPost
ImageToVideoMultipartRequestBody defines body for ImageToVideo for multipart/form-data ContentType.
type ImageToVideoResponse ¶
type ImageToVideoResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *VideoResponse
JSON400 *HTTPError
JSON401 *HTTPError
JSON422 *HTTPValidationError
JSON500 *HTTPError
}
func ParseImageToVideoResponse ¶
func ParseImageToVideoResponse(rsp *http.Response) (*ImageToVideoResponse, error)
ParseImageToVideoResponse parses an HTTP response from a ImageToVideoWithResponse call
func (ImageToVideoResponse) Status ¶
func (r ImageToVideoResponse) Status() string
Status returns HTTPResponse.Status
func (ImageToVideoResponse) StatusCode ¶
func (r ImageToVideoResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type InvalidParamFormatError ¶
func (*InvalidParamFormatError) Error ¶
func (e *InvalidParamFormatError) Error() string
func (*InvalidParamFormatError) Unwrap ¶
func (e *InvalidParamFormatError) Unwrap() error
type MasksResponse ¶ added in v0.2.0
type MasksResponse struct {
// Logits The raw, unnormalized predictions (logits) for the masks.
Logits string `json:"logits"`
// Masks The generated masks.
Masks string `json:"masks"`
// Scores The model's confidence scores for each generated mask.
Scores string `json:"scores"`
}
MasksResponse Response model for object segmentation.
type Media ¶
type Media struct {
// Nsfw Whether the media was flagged as NSFW.
Nsfw bool `json:"nsfw"`
// Seed The seed used to generate the media.
Seed int `json:"seed"`
// Url The URL where the media can be accessed.
Url string `json:"url"`
}
Media A media object containing information about the generated media.
type OptimizationFlags ¶
OptimizationFlags is a map of optimization flags to be passed to the pipeline.
type RequestEditorFn ¶
RequestEditorFn is the function signature for the RequestEditor callback function
type RequiredHeaderError ¶
func (*RequiredHeaderError) Error ¶
func (e *RequiredHeaderError) Error() string
func (*RequiredHeaderError) Unwrap ¶
func (e *RequiredHeaderError) Unwrap() error
type RequiredParamError ¶
type RequiredParamError struct {
ParamName string
}
func (*RequiredParamError) Error ¶
func (e *RequiredParamError) Error() string
type RunnerContainer ¶
type RunnerContainer struct {
RunnerContainerConfig
Name string
Client *ClientWithResponses
}
func NewRunnerContainer ¶
func NewRunnerContainer(ctx context.Context, cfg RunnerContainerConfig, name string) (*RunnerContainer, error)
type RunnerContainerConfig ¶
type RunnerContainerConfig struct {
Type RunnerContainerType
Pipeline string
ModelID string
Endpoint RunnerEndpoint
ContainerImageID string
// For managed containers only
ID string
GPU string
KeepWarm bool
// contains filtered or unexported fields
}
type RunnerContainerType ¶
type RunnerContainerType int
const ( Managed RunnerContainerType = iota External )
type RunnerEndpoint ¶
type SegmentAnything2MultipartRequestBody ¶ added in v0.2.0
type SegmentAnything2MultipartRequestBody = BodySegmentAnything2SegmentAnything2Post
SegmentAnything2MultipartRequestBody defines body for SegmentAnything2 for multipart/form-data ContentType.
type SegmentAnything2Response ¶ added in v0.2.0
type SegmentAnything2Response struct {
Body []byte
HTTPResponse *http.Response
JSON200 *MasksResponse
JSON400 *HTTPError
JSON401 *HTTPError
JSON422 *HTTPValidationError
JSON500 *HTTPError
}
func ParseSegmentAnything2Response ¶ added in v0.2.0
func ParseSegmentAnything2Response(rsp *http.Response) (*SegmentAnything2Response, error)
ParseSegmentAnything2Response parses an HTTP response from a SegmentAnything2WithResponse call
func (SegmentAnything2Response) Status ¶ added in v0.2.0
func (r SegmentAnything2Response) Status() string
Status returns HTTPResponse.Status
func (SegmentAnything2Response) StatusCode ¶ added in v0.2.0
func (r SegmentAnything2Response) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type ServerInterface ¶
type ServerInterface interface {
// Audio To Text
// (POST /audio-to-text)
AudioToText(w http.ResponseWriter, r *http.Request)
// Health
// (GET /health)
Health(w http.ResponseWriter, r *http.Request)
// Image To Image
// (POST /image-to-image)
ImageToImage(w http.ResponseWriter, r *http.Request)
// Image To Video
// (POST /image-to-video)
ImageToVideo(w http.ResponseWriter, r *http.Request)
// Segment Anything 2
// (POST /segment-anything-2)
SegmentAnything2(w http.ResponseWriter, r *http.Request)
// Text To Image
// (POST /text-to-image)
TextToImage(w http.ResponseWriter, r *http.Request)
// Upscale
// (POST /upscale)
Upscale(w http.ResponseWriter, r *http.Request)
}
ServerInterface represents all server handlers.
type ServerInterfaceWrapper ¶
type ServerInterfaceWrapper struct {
Handler ServerInterface
HandlerMiddlewares []MiddlewareFunc
ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}
ServerInterfaceWrapper converts contexts to parameters.
func (*ServerInterfaceWrapper) AudioToText ¶
func (siw *ServerInterfaceWrapper) AudioToText(w http.ResponseWriter, r *http.Request)
AudioToText operation middleware
func (*ServerInterfaceWrapper) Health ¶
func (siw *ServerInterfaceWrapper) Health(w http.ResponseWriter, r *http.Request)
Health operation middleware
func (*ServerInterfaceWrapper) ImageToImage ¶
func (siw *ServerInterfaceWrapper) ImageToImage(w http.ResponseWriter, r *http.Request)
ImageToImage operation middleware
func (*ServerInterfaceWrapper) ImageToVideo ¶
func (siw *ServerInterfaceWrapper) ImageToVideo(w http.ResponseWriter, r *http.Request)
ImageToVideo operation middleware
func (*ServerInterfaceWrapper) SegmentAnything2 ¶ added in v0.2.0
func (siw *ServerInterfaceWrapper) SegmentAnything2(w http.ResponseWriter, r *http.Request)
SegmentAnything2 operation middleware
func (*ServerInterfaceWrapper) TextToImage ¶
func (siw *ServerInterfaceWrapper) TextToImage(w http.ResponseWriter, r *http.Request)
TextToImage operation middleware
func (*ServerInterfaceWrapper) Upscale ¶
func (siw *ServerInterfaceWrapper) Upscale(w http.ResponseWriter, r *http.Request)
Upscale operation middleware
type TextResponse ¶
type TextResponse struct {
// Chunks The generated text chunks.
Chunks []Chunk `json:"chunks"`
// Text The generated text.
Text string `json:"text"`
}
TextResponse Response model for text generation.
type TextToImageJSONRequestBody ¶
type TextToImageJSONRequestBody = TextToImageParams
TextToImageJSONRequestBody defines body for TextToImage for application/json ContentType.
type TextToImageParams ¶
type TextToImageParams struct {
// GuidanceScale Encourages model to generate images closely linked to the text prompt (higher values may reduce image quality).
GuidanceScale *float32 `json:"guidance_scale,omitempty"`
// Height The height in pixels of the generated image.
Height *int `json:"height,omitempty"`
// ModelId Hugging Face model ID used for image generation.
ModelId *string `json:"model_id,omitempty"`
// NegativePrompt Text prompt(s) to guide what to exclude from image generation. Ignored if guidance_scale < 1.
NegativePrompt *string `json:"negative_prompt,omitempty"`
// NumImagesPerPrompt Number of images to generate per prompt.
NumImagesPerPrompt *int `json:"num_images_per_prompt,omitempty"`
// NumInferenceSteps Number of denoising steps. More steps usually lead to higher quality images but slower inference. Modulated by strength.
NumInferenceSteps *int `json:"num_inference_steps,omitempty"`
// Prompt Text prompt(s) to guide image generation. Separate multiple prompts with '|' if supported by the model.
Prompt string `json:"prompt"`
// SafetyCheck Perform a safety check to estimate if generated images could be offensive or harmful.
SafetyCheck *bool `json:"safety_check,omitempty"`
// Seed Seed for random number generation.
Seed *int `json:"seed,omitempty"`
// Width The width in pixels of the generated image.
Width *int `json:"width,omitempty"`
}
TextToImageParams defines model for TextToImageParams.
type TextToImageResponse ¶
type TextToImageResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ImageResponse
JSON400 *HTTPError
JSON401 *HTTPError
JSON422 *HTTPValidationError
JSON500 *HTTPError
}
func ParseTextToImageResponse ¶
func ParseTextToImageResponse(rsp *http.Response) (*TextToImageResponse, error)
ParseTextToImageResponse parses an HTTP response from a TextToImageWithResponse call
func (TextToImageResponse) Status ¶
func (r TextToImageResponse) Status() string
Status returns HTTPResponse.Status
func (TextToImageResponse) StatusCode ¶
func (r TextToImageResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type TooManyValuesForParamError ¶
func (*TooManyValuesForParamError) Error ¶
func (e *TooManyValuesForParamError) Error() string
type UnescapedCookieParamError ¶
func (*UnescapedCookieParamError) Error ¶
func (e *UnescapedCookieParamError) Error() string
func (*UnescapedCookieParamError) Unwrap ¶
func (e *UnescapedCookieParamError) Unwrap() error
type Unimplemented ¶
type Unimplemented struct{}
func (Unimplemented) AudioToText ¶
func (_ Unimplemented) AudioToText(w http.ResponseWriter, r *http.Request)
Audio To Text (POST /audio-to-text)
func (Unimplemented) Health ¶
func (_ Unimplemented) Health(w http.ResponseWriter, r *http.Request)
Health (GET /health)
func (Unimplemented) ImageToImage ¶
func (_ Unimplemented) ImageToImage(w http.ResponseWriter, r *http.Request)
Image To Image (POST /image-to-image)
func (Unimplemented) ImageToVideo ¶
func (_ Unimplemented) ImageToVideo(w http.ResponseWriter, r *http.Request)
Image To Video (POST /image-to-video)
func (Unimplemented) SegmentAnything2 ¶ added in v0.2.0
func (_ Unimplemented) SegmentAnything2(w http.ResponseWriter, r *http.Request)
Segment Anything 2 (POST /segment-anything-2)
func (Unimplemented) TextToImage ¶
func (_ Unimplemented) TextToImage(w http.ResponseWriter, r *http.Request)
Text To Image (POST /text-to-image)
func (Unimplemented) Upscale ¶
func (_ Unimplemented) Upscale(w http.ResponseWriter, r *http.Request)
Upscale (POST /upscale)
type UnmarshalingParamError ¶
func (*UnmarshalingParamError) Error ¶
func (e *UnmarshalingParamError) Error() string
func (*UnmarshalingParamError) Unwrap ¶
func (e *UnmarshalingParamError) Unwrap() error
type UpscaleMultipartRequestBody ¶
type UpscaleMultipartRequestBody = BodyUpscaleUpscalePost
UpscaleMultipartRequestBody defines body for Upscale for multipart/form-data ContentType.
type UpscaleResponse ¶
type UpscaleResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *ImageResponse
JSON400 *HTTPError
JSON401 *HTTPError
JSON422 *HTTPValidationError
JSON500 *HTTPError
}
func ParseUpscaleResponse ¶
func ParseUpscaleResponse(rsp *http.Response) (*UpscaleResponse, error)
ParseUpscaleResponse parses an HTTP response from a UpscaleWithResponse call
func (UpscaleResponse) Status ¶
func (r UpscaleResponse) Status() string
Status returns HTTPResponse.Status
func (UpscaleResponse) StatusCode ¶
func (r UpscaleResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type ValidationError ¶
type ValidationError struct {
Loc []ValidationError_Loc_Item `json:"loc"`
Msg string `json:"msg"`
Type string `json:"type"`
}
ValidationError defines model for ValidationError.
type ValidationErrorLoc0 ¶
type ValidationErrorLoc0 = string
ValidationErrorLoc0 defines model for .
type ValidationError_Loc_Item ¶
type ValidationError_Loc_Item struct {
// contains filtered or unexported fields
}
ValidationError_Loc_Item defines model for ValidationError.loc.Item.
func (ValidationError_Loc_Item) AsValidationErrorLoc0 ¶
func (t ValidationError_Loc_Item) AsValidationErrorLoc0() (ValidationErrorLoc0, error)
AsValidationErrorLoc0 returns the union data inside the ValidationError_Loc_Item as a ValidationErrorLoc0
func (ValidationError_Loc_Item) AsValidationErrorLoc1 ¶
func (t ValidationError_Loc_Item) AsValidationErrorLoc1() (ValidationErrorLoc1, error)
AsValidationErrorLoc1 returns the union data inside the ValidationError_Loc_Item as a ValidationErrorLoc1
func (*ValidationError_Loc_Item) FromValidationErrorLoc0 ¶
func (t *ValidationError_Loc_Item) FromValidationErrorLoc0(v ValidationErrorLoc0) error
FromValidationErrorLoc0 overwrites any union data inside the ValidationError_Loc_Item as the provided ValidationErrorLoc0
func (*ValidationError_Loc_Item) FromValidationErrorLoc1 ¶
func (t *ValidationError_Loc_Item) FromValidationErrorLoc1(v ValidationErrorLoc1) error
FromValidationErrorLoc1 overwrites any union data inside the ValidationError_Loc_Item as the provided ValidationErrorLoc1
func (ValidationError_Loc_Item) MarshalJSON ¶
func (t ValidationError_Loc_Item) MarshalJSON() ([]byte, error)
func (*ValidationError_Loc_Item) MergeValidationErrorLoc0 ¶
func (t *ValidationError_Loc_Item) MergeValidationErrorLoc0(v ValidationErrorLoc0) error
MergeValidationErrorLoc0 performs a merge with any union data inside the ValidationError_Loc_Item, using the provided ValidationErrorLoc0
func (*ValidationError_Loc_Item) MergeValidationErrorLoc1 ¶
func (t *ValidationError_Loc_Item) MergeValidationErrorLoc1(v ValidationErrorLoc1) error
MergeValidationErrorLoc1 performs a merge with any union data inside the ValidationError_Loc_Item, using the provided ValidationErrorLoc1
func (*ValidationError_Loc_Item) UnmarshalJSON ¶
func (t *ValidationError_Loc_Item) UnmarshalJSON(b []byte) error
type VideoResponse ¶
type VideoResponse struct {
// Frames The generated video frames.
Frames [][]Media `json:"frames"`
}
VideoResponse Response model for video generation.
type Worker ¶
type Worker struct {
// contains filtered or unexported fields
}
func (*Worker) AudioToText ¶
func (w *Worker) AudioToText(ctx context.Context, req AudioToTextMultipartRequestBody) (*TextResponse, error)
func (*Worker) HasCapacity ¶
HasCapacity returns true if the worker has capacity for the given pipeline and model ID.
func (*Worker) ImageToImage ¶
func (w *Worker) ImageToImage(ctx context.Context, req ImageToImageMultipartRequestBody) (*ImageResponse, error)
func (*Worker) ImageToVideo ¶
func (w *Worker) ImageToVideo(ctx context.Context, req ImageToVideoMultipartRequestBody) (*VideoResponse, error)
func (*Worker) SegmentAnything2 ¶ added in v0.2.0
func (w *Worker) SegmentAnything2(ctx context.Context, req SegmentAnything2MultipartRequestBody) (*MasksResponse, error)
func (*Worker) TextToImage ¶
func (w *Worker) TextToImage(ctx context.Context, req TextToImageJSONRequestBody) (*ImageResponse, error)
func (*Worker) Upscale ¶
func (w *Worker) Upscale(ctx context.Context, req UpscaleMultipartRequestBody) (*ImageResponse, error)
func (*Worker) Warm ¶
func (w *Worker) Warm(ctx context.Context, pipeline string, modelID string, endpoint RunnerEndpoint, optimizationFlags OptimizationFlags) error