gizai/tasks/upscale
a photo made larger with its detail restored. A model family that upscales gives an Upscaler (gizai/family's upscaler): its GPU, and upscaled, the picture at scale times its size. giz ai upscale and a worker (upscaleService: operation image.upscale) use it.
import * as Upscale from "gizai/tasks/upscale";Types
Upscaler
type Upscaler = { gpu: Gpu; upscaled: (picture: Img.Image, scale: i64, seed: u64) => Img.Image throws string; }What a family gives: the card it loaded on, and upscaled, an RGB picture of picture (RGB or RGBA; alpha
dropped) at scale times its width and height, from the noise of seed.
gpu:M7.Gpuupscaled:(arg0: gizlang_image.Image, arg1: i64, arg2: u64) => gizlang_image.Image throws string
Functions
asked
function asked(file: bytes, scale: i64): Img.Image throws stringThe picture of file (a JPEG, PNG or WebP file's bytes), when it may be upscaled scale times.
Effects: fail, alloc.
upscaleService
function upscaleService(name: string, load: (gpu: Gpu) => Upscaler throws string, capacity: i64 = 4): Hosting.ServiceThe service of upscale model name as giz's inference worker: operation image.upscale, capacity jobs held;
load makes the model on the host's GPU. A job's input: image (an uploaded picture), scale (2 by default) and
seed; its result is upscaled.png.
Effects: fail, read, write, console, io, alloc.
Constants
LONGEST
const LONGEST: i64 = 4096The longest side an upscaled picture may have.
MOST
const MOST: i64 = 4The largest scale.