typefile
{
"enhance_model": "CGI",
"face_enhancement": false,
"face_enhancement_creativity": 0.3,
"face_enhancement_strength": 0.8,
"image": "https://replicate.delivery/pbxt/Mto2sT3qwNZBRT3YMsI1TxiE3LWx0lECZYvV1TsjRDIZNFHN/0_2.jpg",
"output_format": "jpg",
"subject_detection": "Foreground",
"upscale_factor": "4x"
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_2O5**********************************
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 topazlabs/image-upscale using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const input = {
enhance_model: "CGI",
face_enhancement: false,
face_enhancement_creativity: 0.3,
face_enhancement_strength: 0.8,
image: "https://replicate.delivery/pbxt/Mto2sT3qwNZBRT3YMsI1TxiE3LWx0lECZYvV1TsjRDIZNFHN/0_2.jpg",
output_format: "jpg",
subject_detection: "Foreground",
upscale_factor: "4x"
};
const output = await replicate.run("topazlabs/image-upscale", { input });
// 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_2O5**********************************
This is your API token. Keep it to yourself.
import replicate
Run topazlabs/image-upscale using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"topazlabs/image-upscale",
input={
"enhance_model": "CGI",
"face_enhancement": False,
"face_enhancement_creativity": 0.3,
"face_enhancement_strength": 0.8,
"image": "https://replicate.delivery/pbxt/Mto2sT3qwNZBRT3YMsI1TxiE3LWx0lECZYvV1TsjRDIZNFHN/0_2.jpg",
"output_format": "jpg",
"subject_detection": "Foreground",
"upscale_factor": "4x"
}
)
# 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_2O5**********************************
This is your API token. Keep it to yourself.
Run topazlabs/image-upscale 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 $'{
"input": {
"enhance_model": "CGI",
"face_enhancement": false,
"face_enhancement_creativity": 0.3,
"face_enhancement_strength": 0.8,
"image": "https://replicate.delivery/pbxt/Mto2sT3qwNZBRT3YMsI1TxiE3LWx0lECZYvV1TsjRDIZNFHN/0_2.jpg",
"output_format": "jpg",
"subject_detection": "Foreground",
"upscale_factor": "4x"
}
}' \
https://api.replicate.com/v1/models/topazlabs/image-upscale/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
Loading...
{
"id": "qqgfgar6k5rmc0cpdpdtcjfkdr",
"model": "topazlabs/image-upscale",
"version": "hidden",
"input": {
"enhance_model": "CGI",
"face_enhancement": false,
"face_enhancement_creativity": 0.3,
"face_enhancement_strength": 0.8,
"image": "https://replicate.delivery/pbxt/Mto2sT3qwNZBRT3YMsI1TxiE3LWx0lECZYvV1TsjRDIZNFHN/0_2.jpg",
"output_format": "jpg",
"subject_detection": "Foreground",
"upscale_factor": "4x"
},
"logs": "Generating...\nProcessed in 12.5sec\nCredits used: 1\nDownloading 5044505 bytes\nDownloaded 4.81MB in 0.27sec",
"output": "https://replicate.delivery/xezq/7VVfjaxuIxQJXSPPjsKq2r8vKFew5YZMsevaNRJ1Jzt32rMpA/tmpg5dqe4si.jpg",
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2025-04-25T15:39:58.489Z",
"started_at": "2025-04-25T15:39:58.500408Z",
"completed_at": "2025-04-25T15:40:11.448789Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/qqgfgar6k5rmc0cpdpdtcjfkdr/cancel",
"get": "https://api.replicate.com/v1/predictions/qqgfgar6k5rmc0cpdpdtcjfkdr",
"stream": "https://stream.replicate.com/v1/files/bcwr-n2xwuspo2titmlph3otc7zta2hcrhfq6hg75lhugvpoib4w7maka",
"web": "https://replicate.com/p/qqgfgar6k5rmc0cpdpdtcjfkdr"
},
"metrics": {
"image_count": 1,
"predict_time": 12.948381181,
"total_time": 12.959789
}
}