nightmareai / real-esrgan

Real-ESRGAN with optional face correction and adjustable upscale

  • Public
  • 60.9M runs
  • T4
  • GitHub
  • License

Run nightmareai/real-esrgan with an API

Use one of our client libraries to get started quickly.

Set the REPLICATE_API_TOKEN environment variable

export REPLICATE_API_TOKEN=<paste-your-token-here>

Learn more about authentication

Install Replicate’s Node.js client library

npm install replicate
Learn more about setup

Run nightmareai/real-esrgan using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.

import Replicate from "replicate";
const replicate = new Replicate();

const input = {
    image: "https://replicate.delivery/pbxt/Ing7Fa4YMk6YtcoG1YZnaK3UwbgDB5guRc5M2dEjV6ODNLMl/cat.jpg",
    scale: 2
};

const output = await replicate.run("nightmareai/real-esrgan:f121d640bd286e1fdc67f9799164c1d5be36ff74576ee11c803ae5b665dd46aa", { input });

import { writeFile } from "node:fs/promises";
await writeFile("output.png", output);
//=> output.png written to disk
Learn more