Views
No views yet
npm i @huggingface/transformersXenova/4x_APISR_GRL_GAN_generator-onnx.1import { pipeline } from '@huggingface/transformers';
2
3// Create image-to-image pipeline
4const upscaler = await pipeline('image-to-image', 'Xenova/4x_APISR_GRL_GAN_generator-onnx', {
5 dtype: "fp32",
6});
7
8// Upscale an image
9const url = 'https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/anime.png';
10const output = await upscaler(url);
11// RawImage {
12// data: Uint8Array(16588800) [ ... ],
13// width: 2560,
14// height: 1920,
15// channels: 3
16// }
17
18// (Optional) Save the upscaled image
19output.save('upscaled.png');


onnx).