typefile
{
"background_enhance": true,
"codeformer_fidelity": 0.7,
"face_upsample": true,
"image": "https://replicate.delivery/pbxt/KK4cuxx4zWJUI0PumjFUO0JONXGj8wCxGSGRorcSyjlUuLwH/low-quality-face.jpg",
"upscale": 2
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_CZJ**********************************
This is your API token. Keep it to yourself.
import Replicate from "replicate";
import fs from "node:fs";
const replicate = new Replicate({
auth: process.env.REPLICATE_API_TOKEN,
});
Run sczhou/codeformer using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"sczhou/codeformer:7de2ea26c616d5bf2245ad0d5e24f0ff9a6204578a5c876db53142edd9d2cd56",
{
input: {
background_enhance: true,
codeformer_fidelity: 0.7,
face_upsample: true,
image: "https://replicate.delivery/pbxt/KK4cuxx4zWJUI0PumjFUO0JONXGj8wCxGSGRorcSyjlUuLwH/low-quality-face.jpg",
upscale: 2
}
}
);
// To access the file URL:
console.log(output.url()); //=> "http://example.com"
// To write the file to disk:
fs.writeFile("my-image.png", output);
To learn more, take a look at the guide on getting started with Node.js.
pip install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_CZJ**********************************
This is your API token. Keep it to yourself.
import replicate
Run sczhou/codeformer using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"sczhou/codeformer:7de2ea26c616d5bf2245ad0d5e24f0ff9a6204578a5c876db53142edd9d2cd56",
input={
"background_enhance": True,
"codeformer_fidelity": 0.7,
"face_upsample": True,
"image": "https://replicate.delivery/pbxt/KK4cuxx4zWJUI0PumjFUO0JONXGj8wCxGSGRorcSyjlUuLwH/low-quality-face.jpg",
"upscale": 2
}
)
# To access the file URL:
print(output.url())
#=> "http://example.com"
# To write the file to disk:
with open("my-image.png", "wb") as file:
file.write(output.read())
To learn more, take a look at the guide on getting started with Python.
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_CZJ**********************************
This is your API token. Keep it to yourself.
Run sczhou/codeformer using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
curl -s -X POST \
-H "Authorization: Bearer $REPLICATE_API_TOKEN" \
-H "Content-Type: application/json" \
-H "Prefer: wait" \
-d $'{
"version": "sczhou/codeformer:7de2ea26c616d5bf2245ad0d5e24f0ff9a6204578a5c876db53142edd9d2cd56",
"input": {
"background_enhance": true,
"codeformer_fidelity": 0.7,
"face_upsample": true,
"image": "https://replicate.delivery/pbxt/KK4cuxx4zWJUI0PumjFUO0JONXGj8wCxGSGRorcSyjlUuLwH/low-quality-face.jpg",
"upscale": 2
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
Loading...
{
"id": "umkqczdb23almb5cpwl7wia5ne",
"model": "sczhou/codeformer",
"version": "7de2ea26c616d5bf2245ad0d5e24f0ff9a6204578a5c876db53142edd9d2cd56",
"input": {
"background_enhance": true,
"codeformer_fidelity": 0.7,
"face_upsample": true,
"image": "https://replicate.delivery/pbxt/KK4cuxx4zWJUI0PumjFUO0JONXGj8wCxGSGRorcSyjlUuLwH/low-quality-face.jpg",
"upscale": 2
},
"logs": "detect 1 faces",
"output": "https://replicate.delivery/pbxt/ZP93tHJR4WLWJd0nQeeUDLWrWGf4h6JnUQ9GQcgSMSYpNDkkA/output.png",
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2024-01-31T15:30:58.859354Z",
"started_at": "2024-01-31T15:30:58.899629Z",
"completed_at": "2024-01-31T15:31:01.794446Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/umkqczdb23almb5cpwl7wia5ne/cancel",
"get": "https://api.replicate.com/v1/predictions/umkqczdb23almb5cpwl7wia5ne"
},
"metrics": {
"predict_time": 2.894817,
"total_time": 2.935092
}
}