gizai/tasks/cutout
background removal. A model family that cuts the subject out of a picture gives a Cutter (gizai/family's cutout): its GPU, and alpha, the subject's alpha at the picture's size. giz ai cutout, a worker (cutoutService: operation image.cutout) and a program use every such model so.
import * as Cutout from "gizai/tasks/cutout";Types
Cutter
type Cutter = { gpu: Gpu; alpha: (picture: Img.Image) => bytes throws string; }What a family gives: the card it loaded on, and alpha, the subject's alpha of picture (one byte a pixel at the
picture's size, 255 the subject).
gpu:M7.Gpualpha:(picture: gizlang_image.Image) => bytes throws string
Functions
cut
function cut(c: Cutter, picture: bytes): bytes throws stringpicture (a JPEG, PNG or WebP file's bytes) with its background transparent: a PNG of its RGB and the subject's
alpha.
Effects: fail, read, write, console, io, alloc.
cutoutService
function cutoutService(name: string, load: (gpu: Gpu) => Cutter throws string, capacity: i64 = 4): Hosting.ServiceThe service of cutout model name as giz's inference worker: operation image.cutout, capacity jobs held; load
makes the model on the host's GPU. A job's input: image (an uploaded picture); its result is cutout.png.
Effects: fail, read, write, console, io, alloc.