replicate.com Open in urlscan Pro
2606:4700:20::ac43:4557  Public Scan

URL: https://replicate.com/tencentarc/gfpgan
Submission: On April 02 via manual from NP — Scanned from DE

Form analysis 1 forms found in the DOM

<form data-testid="input-form" id="input-form">
  <div class="mb-3" data-testid="initial-file-input">
    <div>
      <a data-testid="value-img-url-image" href="https://replicate.delivery/mgxm/59d9390c-b415-47e0-a907-f81b0d9920f1/187400315-87a90ac9-d231-45d6-b377-38702bd1838f.jpg" rel="noreferrer" target="_blank" class="inline-flex flex-col"><img data-testid="value-img-image" src="https://replicate.delivery/mgxm/59d9390c-b415-47e0-a907-f81b0d9920f1/187400315-87a90ac9-d231-45d6-b377-38702bd1838f.jpg" alt="img" class="max-w-full"></a>
    </div>
  </div>
  <div class="py-2.5" data-type="string" data-name="img">
    <div class="flex flex-col gap-2 group" data-disabled="true">
      <div class="flex items-center">
        <div class="flex items-center"><label class="text-r8-base font-mono" for="img">
            <div class="flex items-center gap-1.5" translate="no"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" fill="currentColor" viewBox="0 0 256 256" aria-hidden="true">
                <path d="M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM160,51.31,188.69,80H160ZM200,216H56V40h88V88a8,8,0,0,0,8,8h48V216Z"></path>
              </svg>img</div>
          </label><span class="text-r8-red-10">*</span><span class="ml-1.5 font-sans text-r8-sm text-r8-gray-10">file</span></div>
      </div>
      <div class="flex flex-col gap-2">
        <div role="presentation" class="bg-r8-gray-2 p-4 border border-r8-gray-7 border-dashed hover:border-r8-gray-9 cursor-pointer group-data-[disabled=true]:cursor-not-allowed group-data-[disabled=true]:hover:border-r8-gray-7"><input type="file"
            tabindex="-1" id="img" style="display: none;">
          <p class="text-r8-sm text-r8-gray-11 flex items-center gap-2 select-none"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 256 256" aria-hidden="true">
              <path
                d="M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM160,51.31,188.69,80H160ZM200,216H56V40h88V88a8,8,0,0,0,8,8h48V216Zm-40-64a8,8,0,0,1-8,8H136v16a8,8,0,0,1-16,0V160H104a8,8,0,0,1,0-16h16V128a8,8,0,0,1,16,0v16h16A8,8,0,0,1,160,152Z">
              </path>
            </svg>Drop a file or click to upload</p>
          <div data-testid="simple-preview" class="flex items-center mt-1 overflow-hidden">
            <div class="truncate min-w-0">
              <p class="text-r8-sm text-r8-gray-11 truncate">https://replicate.delivery/mgxm/59d9390c-b415-47e0-a907-f81b0d9920f1/187400315-87a90ac9-d231-45d6-b377-38702bd1838f.jpg</p>
            </div>
            <div class="flex-shrink-0 ml-2"><button class="w-6 h-6 rounded-full hover:bg-r8-gray-6 flex items-center justify-center" type="button"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor"
                  viewBox="0 0 256 256">
                  <path
                    d="M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z">
                  </path>
                </svg></button></div>
          </div>
        </div><button disabled="" type="button" class="p-4 w-full h-full bg-r8-gray-2 border border-r8-gray-7 hover:border-r8-gray-9 disabled:hover:border-r8-gray-7 disabled:cursor-not-allowed">
          <p class="text-r8-sm text-r8-gray-10 select-none flex items-center gap-2"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 256 256" aria-hidden="true">
              <path
                d="M208,56H180.28L166.65,35.56A8,8,0,0,0,160,32H96a8,8,0,0,0-6.65,3.56L75.71,56H48A24,24,0,0,0,24,80V192a24,24,0,0,0,24,24H208a24,24,0,0,0,24-24V80A24,24,0,0,0,208,56Zm8,136a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V80a8,8,0,0,1,8-8H80a8,8,0,0,0,6.66-3.56L100.28,48h55.43l13.63,20.44A8,8,0,0,0,176,72h32a8,8,0,0,1,8,8ZM128,88a44,44,0,1,0,44,44A44.05,44.05,0,0,0,128,88Zm0,72a28,28,0,1,1,28-28A28,28,0,0,1,128,160Z">
              </path>
            </svg>Take a photo with your webcam</p>
        </button>
      </div>
    </div>
    <div class="mt-2 space-y-1">
      <p class="text-r8-sm text-r8-gray-12">Input</p>
    </div>
  </div>
  <div class="py-2.5" data-type="string" data-name="version">
    <div class="gap-2 flex flex-col">
      <div class="flex items-center"><label class="text-r8-base font-mono" for="version">
          <div class="flex items-center gap-1.5" translate="no"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" fill="currentColor" viewBox="0 0 256 256" aria-hidden="true">
              <path d="M224,128a8,8,0,0,1-8,8H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128ZM40,72H216a8,8,0,0,0,0-16H40a8,8,0,0,0,0,16ZM216,184H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Z"></path>
            </svg>version</div>
        </label><span class="ml-1.5 font-sans text-r8-sm text-r8-gray-10">string</span></div>
      <div class="tw-select"><select disabled="" id="version" class="w-full border p-2 border-black disabled:cursor-not-allowed disabled:opacity-50" name="version">
          <option value="v1.2">v1.2</option>
          <option value="v1.3">v1.3</option>
          <option value="v1.4">v1.4</option>
          <option value="RestoreFormer">RestoreFormer</option>
        </select></div>
    </div>
    <div class="mt-2 space-y-1">
      <p class="text-r8-sm text-r8-gray-12">GFPGAN version. v1.3: better quality. v1.4: more details and better identity.</p>
      <p class="text-r8-sm text-r8-gray-11">Default: "v1.4"</p>
    </div>
  </div>
  <div class="py-2.5" data-type="number" data-name="scale">
    <div class="gap-2 flex flex-col">
      <div class="flex flex-col md:flex-row md:items-center md:justify-between">
        <div class="flex items-center"><label class="text-r8-base font-mono" for="scale">
            <div class="flex items-center gap-1.5" translate="no"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" fill="currentColor" viewBox="0 0 256 256" aria-hidden="true">
                <path
                  d="M224,88H175.4l8.47-46.57a8,8,0,0,0-15.74-2.86l-9,49.43H111.4l8.47-46.57a8,8,0,0,0-15.74-2.86L95.14,88H48a8,8,0,0,0,0,16H92.23L83.5,152H32a8,8,0,0,0,0,16H80.6l-8.47,46.57a8,8,0,0,0,6.44,9.3A7.79,7.79,0,0,0,80,224a8,8,0,0,0,7.86-6.57l9-49.43H144.6l-8.47,46.57a8,8,0,0,0,6.44,9.3A7.79,7.79,0,0,0,144,224a8,8,0,0,0,7.86-6.57l9-49.43H208a8,8,0,0,0,0-16H163.77l8.73-48H224a8,8,0,0,0,0-16Zm-76.5,64H99.77l8.73-48h47.73Z">
                </path>
              </svg>scale</div>
          </label><span class="ml-1.5 font-sans text-r8-sm text-r8-gray-10">number</span></div>
      </div>
      <div>
        <div class="flex gap-4"><input id="scale" class="border p-2 border-black w-full flex-shrink-0 disabled:cursor-not-allowed disabled:opacity-50 max-w-full min-w-[5rem]" dir="auto" disabled="" step="0.01" type="number" name="scale" value="2">
        </div>
      </div>
    </div>
    <div class="mt-2 space-y-1">
      <p class="text-r8-sm text-r8-gray-12">Rescaling factor</p>
      <p class="text-r8-sm text-r8-gray-11">Default: 2</p>
    </div>
  </div>
</form>

Text Content

Explore Pricing Docs Blog Changelog Sign in Get started
Menu
ExplorePricingDocsBlogChangelogSign in


TENCENTARC/ GFPGAN


Practical face restoration algorithm for *old photos* or *AI-generated faces*

   Warm
 * Public
 * 71M runs
 * GitHub
 * Paper
 * License

Run with an API
Playground API Examples README Versions



INPUT

FormNode.jsPythonElixirHTTPCogDocker
img
*file

Drop a file or click to upload

https://replicate.delivery/mgxm/59d9390c-b415-47e0-a907-f81b0d9920f1/187400315-87a90ac9-d231-45d6-b377-38702bd1838f.jpg



Take a photo with your webcam

Input

version
string
v1.2v1.3v1.4RestoreFormer

GFPGAN version. v1.3: better quality. v1.4: more details and better identity.

Default: "v1.4"

scale
number


Rescaling factor

Default: 2

Run this model in Node.js with one line of code:

npx create-replicate --model=tencentarc/gfpgan
or set up a project from scratch
Install Replicate’s Node.js client library:

npm install replicate

Copy
Set the REPLICATE_API_TOKEN environment variable:

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

VisibilityCopy

Find your API token in your account settings.

Import and set up the client:

import Replicate from "replicate";

const replicate = new Replicate({
  auth: process.env.REPLICATE_API_TOKEN,
});

Copy

Run tencentarc/gfpgan using Replicate’s API. Check out the model's API reference
for a detailed overview of the input/output schemas.

const output = await replicate.run(
  "tencentarc/gfpgan:0fbacf7afc6c144e5be9767cff80f25aff23e52b0708f17e20f9879b2f21516c",
  {
    input: {
      img: "https://replicate.delivery/mgxm/59d9390c-b415-47e0-a907-f81b0d9920f1/187400315-87a90ac9-d231-45d6-b377-38702bd1838f.jpg",
      scale: 2,
      version: "v1.4"
    }
  }
);
console.log(output);

Copy

To learn more, take a look at the guide on getting started with Node.js.

Install Replicate’s Python client library:

pip install replicate

Copy
Set the REPLICATE_API_TOKEN environment variable:

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

VisibilityCopy

Find your API token in your account settings.

Import the client:

import replicate

Copy

Run tencentarc/gfpgan using Replicate’s API. Check out the model's API reference
for a detailed overview of the input/output schemas.

output = replicate.run(
    "tencentarc/gfpgan:0fbacf7afc6c144e5be9767cff80f25aff23e52b0708f17e20f9879b2f21516c",
    input={
        "img": "https://replicate.delivery/mgxm/59d9390c-b415-47e0-a907-f81b0d9920f1/187400315-87a90ac9-d231-45d6-b377-38702bd1838f.jpg",
        "scale": 2,
        "version": "v1.4"
    }
)
print(output)

Copy

To learn more, take a look at the guide on getting started with Python.

Install Replicate’s Elixir client library:

Add replicate to your Mix project’s dependencies:

def deps do
  [
    {:replicate, "~> 1.2.0"}
  ]
end

Copy
Set the REPLICATE_API_TOKEN environment variable:

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

VisibilityCopy

Find your API token in your account settings.

Add the configuration to your config.exs:

config :replicate,
  replicate_api_token: System.get_env("REPLICATE_API_TOKEN")

Copy

Run tencentarc/gfpgan using Replicate’s API. Check out the model's API reference
for a detailed overview of the input/output schemas.

output = Replicate.run(
  "tencentarc/gfpgan:0fbacf7afc6c144e5be9767cff80f25aff23e52b0708f17e20f9879b2f21516c",
  input: %{
    "img": "https://replicate.delivery/mgxm/59d9390c-b415-47e0-a907-f81b0d9920f1/187400315-87a90ac9-d231-45d6-b377-38702bd1838f.jpg",
    "scale": 2,
    "version": "v1.4"
  }
)
IO.inspect(output)

Copy

To learn more, take a look at the client library’s readme.

Set the REPLICATE_API_TOKEN environment variable:

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

VisibilityCopy

Find your API token in your account settings.

Run tencentarc/gfpgan using Replicate’s API. Check out the model's API reference
for a detailed overview of the input/output schemas.

curl -s -X POST \
  -H "Authorization: Token $REPLICATE_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d $'{
    "version": "0fbacf7afc6c144e5be9767cff80f25aff23e52b0708f17e20f9879b2f21516c",
    "input": {
      "img": "https://replicate.delivery/mgxm/59d9390c-b415-47e0-a907-f81b0d9920f1/187400315-87a90ac9-d231-45d6-b377-38702bd1838f.jpg",
      "scale": 2,
      "version": "v1.4"
    }
  }' \
  https://api.replicate.com/v1/predictions

Copy

To learn more, take a look at Replicate’s HTTP API reference docs.

Install Cog:

brew install cog

Copy

If you don’t have Homebrew, there are other installation options available.

Pull and run tencentarc/gfpgan using Cog (this will download the full model and
run it in your local environment):

cog predict r8.im/tencentarc/gfpgan@sha256:0fbacf7afc6c144e5be9767cff80f25aff23e52b0708f17e20f9879b2f21516c \
  -i 'img="https://replicate.delivery/mgxm/59d9390c-b415-47e0-a907-f81b0d9920f1/187400315-87a90ac9-d231-45d6-b377-38702bd1838f.jpg"' \
  -i 'scale=2' \
  -i 'version="v1.4"'

Copy

To learn more, take a look at the Cog documentation.

Pull and run tencentarc/gfpgan using Docker (this will download the full model
and run it in your local environment):

docker run -d -p 5000:5000 --gpus=all r8.im/tencentarc/gfpgan@sha256:0fbacf7afc6c144e5be9767cff80f25aff23e52b0708f17e20f9879b2f21516c
curl -s -X POST \
  -H "Content-Type: application/json" \
  -d $'{
    "input": {
      "img": "https://replicate.delivery/mgxm/59d9390c-b415-47e0-a907-f81b0d9920f1/187400315-87a90ac9-d231-45d6-b377-38702bd1838f.jpg",
      "scale": 2,
      "version": "v1.4"
    }
  }' \
  http://localhost:5000/predictions

Copy

Set up billing to run this model.

Set up billing



OUTPUT

PreviewJSON
Fullscreen
Before
After


{
  "completed_at": "2022-09-04T15:41:29.906994Z",
  "created_at": "2022-09-04T15:41:27.941644Z",
  "error": null,
  "id": "ffu2e6aw4barxliwxu23ydgbnu",
  "input": {
    "img": "https://replicate.delivery/mgxm/59d9390c-b415-47e0-a907-f81b0d9920f1/187400315-87a90ac9-d231-45d6-b377-38702bd1838f.jpg",
    "scale": 2,
    "version": "v1.4"
  },
  "logs": "/tmp/tmpky22vsq_187400315-87a90ac9-d231-45d6-b377-38702bd1838f.jpg v1.4 2.0",
  "metrics": {
    "predict_time": 1.674856,
    "total_time": 1.96535
  },
  "output": "https://replicate.delivery/mgxm/85f53415-0dc7-4703-891f-1e6f912119ad/output.png",
  "started_at": "2022-09-04T15:41:28.232138Z",
  "status": "succeeded",
  "urls": {
    "get": "https://api.replicate.com/v1/predictions/ffu2e6aw4barxliwxu23ydgbnu",
    "cancel": "https://api.replicate.com/v1/predictions/ffu2e6aw4barxliwxu23ydgbnu/cancel"
  },
  "version": "297a243ce8643961d52f745f9b6c8c1bd96850a51c92be5f43628a0d3e08321a"
}

Copy

Generated in 1.7 seconds

Tweak itShareDownloadReport
Show logs
/tmp/tmpky22vsq_187400315-87a90ac9-d231-45d6-b377-38702bd1838f.jpg v1.4 2.0
Copy logsFullscreen logsDownload logs

This example was created by a different version, tencentarc/gfpgan:297a243c.



EXAMPLES

View more examples



RUN TIME AND COST

This model runs on Nvidia A40 GPU hardware. Predictions typically complete
within 6 seconds.

README


REPLICATE DEMO FOR GFPGAN

(You may need to login in to upload images~)

GFPGAN aims at developing Practical Algorithm for Real-world Face Restoration.

If GFPGAN is helpful, please help to ⭐ the Github Repo and recommend it to your
friends 😊




📧CONTACT

If you have any question, please email xintao.wang@outlook.com or
xintaowang@tencent.com.

Replicate

About Guides Terms Privacy Status GitHub X Discord Support
Copy model name


Copy

Show

Copy

Copy

Copy

Copy

Show

Copy

Copy

Copy

Copy

Show

Copy

Copy

Copy

Show

Copy

Copy

Copy

Copy

Copy

Copy


LOGS (FFU2E6AW4BARXLIWXU23YDGBNU)

Succeeded
/tmp/tmpky22vsq_187400315-87a90ac9-d231-45d6-b377-38702bd1838f.jpg v1.4 2.0