SUPIR Upscaler

fal-ai/supir
Inference
Research only

1. Calling the API#

Install the client#

The client provides a convenient way to interact with the model API.

npm install --save @fal-ai/serverless-client

Setup your API Key#

Set FAL_KEY as an environment variable in your runtime.

export FAL_KEY="YOUR_API_KEY"

Submit a request#

The client API handles the API submit protocol. It will handle the request status updates and return the result when the request is completed.

import * as fal from "@fal-ai/serverless-client";

const result = await fal.subscribe("fal-ai/supir", {
  input: {
    image_url: "https://storage.googleapis.com/falserverless/gallery/NOCA_Mick-Thompson.resized.resized.jpg"
  },
  logs: true,
  onQueueUpdate: (update) => {
    if (update.status === "IN_PROGRESS") {
      update.logs.map((log) => log.message).forEach(console.log);
    }
  },
});

2. Authentication#

The API uses an API Key for authentication. It is recommended you set the FAL_KEY environment variable in your runtime when possible.

API Key#

In case your app is running in an environment where you cannot set environment variables, you can set the API Key manually as a client configuration.
import * as fal from "@fal-ai/serverless-client";

fal.config({
  credentials: "YOUR_FAL_KEY"
});

3. Files#

Some attributes in the API accept file URLs as input. Whenever that's the case you can pass your own URL or a Base64 data URI.

Data URI (base64)#

You can pass a Base64 data URI as a file input. The API will handle the file decoding for you. Keep in mind that for large files, this alternative although convenient can impact the request performance.

Hosted files (URL)#

You can also pass your own URLs as long as they are publicly accessible. Be aware that some hosts might block cross-site requests, rate-limit, or consider the request as a bot.

Uploading files#

We provide a convenient file storage that allows you to upload files and use them in your requests. You can upload files using the client API and use the returned URL in your requests.

import * as fal from "@fal-ai/serverless-client";

// Upload a file (you can get a file reference from an input element or a drag-and-drop event)
const file = new File(["Hello, World!"], "hello.txt", { type: "text/plain" });
const url = await fal.storage.upload(file);

// Use the URL in your request
const result = await fal.subscribe("fal-ai/supir", { image_url: url });

Read more about file handling in our file upload guide.

4. Schema#

Input#

image_url*string

The URL of the image to be upscaled.

model_typeModelTypeEnum

The model type to use. Q is the default and is recommended for most use cases. Default value: "Q"

Possible values: "Q", "F"

upscaleinteger

Upsampling ratio of given inputs. Default value: 2

tileboolean

Whether to tile or not. Default is False.

tile_sizeinteger

Tile size. Default is 1024. Default value: 1024

tile_strideinteger

Tile stride. Default is 512. Default value: 512

tile_vaeboolean

Whether to tile VAE or not. Default is False.

encoder_tile_sizeinteger

VAE Encoder tile size. Default is 512. Default value: 512

decoder_tile_sizeinteger

VAE Decoder tile size. Default is 64. Default value: 64

min_sizefloat

Minimum resolution of output images. Default value: 1024

edm_stepsinteger

Number of steps for EDM Sampling Schedule. Default value: 50

use_llavaboolean

Use LLaVA model to get captions. Default is False, thus if a prompt is not provide the empty prompt will be used

a_promptstring

Additive positive prompt for the inputs. Default value: "hyper detailed, maximum detail, 32k, Color Grading, ultra HD, extreme meticulous detailing, skin pore detailing, hyper sharpness, perfect"

n_promptstring

Negative prompt for the inputs. Default value: "blurring, dirty, messy, worst quality, low quality, frames, watermark, signature, jpeg artifacts, deformed, lowres, over-smooth"

color_fix_typeColorFixTypeEnum

Color Correction Method Default value: "Wavelet"

Possible values: "None", "AdaIn", "Wavelet"

s_stage1integer

Control Strength of Stage1 (negative means invalid). Default value: -1

s_churnfloat

Original churn hy-param of EDM. Default value: 5

s_noisefloat

Original noise hy-param of EDM. Default value: 1.003

s_cfgfloat

Classifier-free guidance scale for prompts. Default value: 7.5

s_stage2float

Control Strength of Stage2. Default value: 1

linear_CFGboolean

Linearly (with sigma) increase CFG from 'spt_linear_CFG' to s_cfg.

linear_s_stage2boolean

Linearly (with sigma) increase s_stage2 from 'spt_linear_s_stage2' to s_stage2.

spt_linear_CFGfloat

Start point of linearly increasing CFG. Default value: 1

spt_linear_s_stage2float

Start point of linearly increasing s_stage2.

seedinteger

Seed for reproducibility. Different seeds will make slightly different results.

per_tile_llava_promptboolean

Whether to use LLaVA prompt per tile or not. This will only be used if no prompt is provided and use_llava is true. Default is false

{
  "image_url": "https://storage.googleapis.com/falserverless/gallery/NOCA_Mick-Thompson.resized.resized.jpg",
  "model_type": "Q",
  "upscale": 2,
  "tile_size": 1024,
  "tile_stride": 512,
  "encoder_tile_size": 512,
  "decoder_tile_size": 64,
  "min_size": 1024,
  "edm_steps": 50,
  "a_prompt": "hyper detailed, maximum detail, 32k, Color Grading, ultra HD, extreme meticulous detailing, skin pore detailing, hyper sharpness, perfect",
  "n_prompt": "blurring, dirty, messy, worst quality, low quality, frames, watermark, signature, jpeg artifacts, deformed, lowres, over-smooth",
  "color_fix_type": "None",
  "s_stage1": -1,
  "s_churn": 5,
  "s_noise": 1.003,
  "s_cfg": 7.5,
  "s_stage2": 1,
  "spt_linear_CFG": 1
}

Output#

image*Image

The generated image file info.

seed*integer

The seed used for the generation.

{
  "image": {
    "url": "",
    "content_type": "image/png",
    "file_name": "z9RV14K95DvU.png",
    "file_size": 4404019,
    "width": 1024,
    "height": 1024
  }
}