package imagegen import "context" // FaceRestoreRequest asks a face-restoration backend (GFPGAN style) to repair // degraded faces in a photo. Zero values mean "backend default" (ADR-0023). type FaceRestoreRequest struct { // Image is the image to restore. Required. Image Image // Upscale is the output enlargement factor (1 or 2 on the reference // backend); 0 = backend default. Upscale int } // FaceRestoreOption mutates a FaceRestoreRequest before it is sent. type FaceRestoreOption func(*FaceRestoreRequest) // WithFaceRestoreUpscale sets the output enlargement factor. func WithFaceRestoreUpscale(n int) FaceRestoreOption { return func(r *FaceRestoreRequest) { r.Upscale = n } } // Apply returns a copy of the request with all options applied. func (r FaceRestoreRequest) Apply(opts ...FaceRestoreOption) FaceRestoreRequest { for _, opt := range opts { opt(&r) } return r } // FaceRestorer repairs degraded/blurry faces in photos. type FaceRestorer interface { // RestoreFaces returns the restored image as a one-image Result. RestoreFaces(ctx context.Context, req FaceRestoreRequest, opts ...FaceRestoreOption) (*Result, error) } // FaceRestoreModelOption configures a FaceRestorer at construction time. // Reserved for future per-model settings. type FaceRestoreModelOption func(*FaceRestoreModelConfig) // FaceRestoreModelConfig carries per-model construction settings. type FaceRestoreModelConfig struct{} // ApplyFaceRestoreModelOptions folds options into a config. func ApplyFaceRestoreModelOptions(opts []FaceRestoreModelOption) FaceRestoreModelConfig { var cfg FaceRestoreModelConfig for _, opt := range opts { opt(&cfg) } return cfg } // FaceRestoreProvider mints FaceRestorers bound to one backend. type FaceRestoreProvider interface { // Name is the registry identifier for the provider. Name() string // FaceRestoreModel returns a FaceRestorer bound to the given id (passed // through to the backend verbatim; no catalog validation). FaceRestoreModel(id string, opts ...FaceRestoreModelOption) (FaceRestorer, error) }