Prediction
sczhou/codeformer:7de2ea26c616d5bf2245ad0d5e24f0ff9a6204578a5c876db53142edd9d2cd56Input
{
"image": "https://replicate.delivery/pbxt/KK4qNvFn2Hx80Gqlc7fTbeKftHx76loyJvMQqdTDEmsmQYUd/0_0-1.webp",
"upscale": 1,
"face_upsample": true,
"background_enhance": true,
"codeformer_fidelity": 0.7
}
Install Replicate’s Node.js client library:
npm install replicate
Set the
REPLICATE_API_TOKEN
environment variable:export REPLICATE_API_TOKEN=<paste-your-token-here>
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,
});
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: {
image: "https://replicate.delivery/pbxt/KK4qNvFn2Hx80Gqlc7fTbeKftHx76loyJvMQqdTDEmsmQYUd/0_0-1.webp",
upscale: 1,
face_upsample: true,
background_enhance: true,
codeformer_fidelity: 0.7
}
}
);
// 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.
Install Replicate’s Python client library:
pip install replicate
Set the
REPLICATE_API_TOKEN
environment variable:export REPLICATE_API_TOKEN=<paste-your-token-here>
Find your API token in your account settings.
Import the client:
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={
"image": "https://replicate.delivery/pbxt/KK4qNvFn2Hx80Gqlc7fTbeKftHx76loyJvMQqdTDEmsmQYUd/0_0-1.webp",
"upscale": 1,
"face_upsample": True,
"background_enhance": True,
"codeformer_fidelity": 0.7
}
)
print(output)
To learn more, take a look at the guide on getting started with Python.
Set the
REPLICATE_API_TOKEN
environment variable:export REPLICATE_API_TOKEN=<paste-your-token-here>
Find your API token in your account settings.
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": {
"image": "https://replicate.delivery/pbxt/KK4qNvFn2Hx80Gqlc7fTbeKftHx76loyJvMQqdTDEmsmQYUd/0_0-1.webp",
"upscale": 1,
"face_upsample": true,
"background_enhance": true,
"codeformer_fidelity": 0.7
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
Output
Loading...
{
"completed_at": "2024-01-31T15:45:40.505780Z",
"created_at": "2024-01-31T15:45:11.942631Z",
"data_removed": false,
"error": null,
"id": "hmygys3bahjiynjdwgqlojm4vy",
"input": {
"image": "https://replicate.delivery/pbxt/KK4qNvFn2Hx80Gqlc7fTbeKftHx76loyJvMQqdTDEmsmQYUd/0_0-1.webp",
"upscale": 1,
"face_upsample": true,
"background_enhance": true,
"codeformer_fidelity": 0.7
},
"logs": "detect 1 faces",
"metrics": {
"predict_time": 3.004273,
"total_time": 28.563149
},
"output": "https://replicate.delivery/pbxt/Qghg1XZtwZpAAhDEdtPkMspww1Au2hfMq9Yoyjh816fj0BSSA/output.png",
"started_at": "2024-01-31T15:45:37.501507Z",
"status": "succeeded",
"urls": {
"get": "https://api.replicate.com/v1/predictions/hmygys3bahjiynjdwgqlojm4vy",
"cancel": "https://api.replicate.com/v1/predictions/hmygys3bahjiynjdwgqlojm4vy/cancel"
},
"version": "7de2ea26c616d5bf2245ad0d5e24f0ff9a6204578a5c876db53142edd9d2cd56"
}
Generated in
detect 1 faces