Views
No views yet
npm i @huggingface/transformersXenova/swin2SR-classical-sr-x2-64.1import { pipeline } from '@huggingface/transformers';
2
3// Create image-to-image pipeline
4const upscaler = await pipeline('image-to-image', 'Xenova/swin2SR-classical-sr-x2-64', {
5 dtype: 'fp32', // Options: 'fp32', 'fp16', 'q8', 'q4'
6});
7
8// Upscale an image
9const url = 'https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/butterfly.jpg';
10const output = await upscaler(url);
11// RawImage {
12// data: Uint8Array(786432) [ ... ],
13// width: 512,
14// height: 512,
15// channels: 3
16// }
17
18// (Optional) Save the upscaled image
19output.save('upscaled.png');

onnx).