typefile
{
"img": "https://replicate.delivery/pbxt/JHZ4Fx3YeSIMGk8x0uPROPKZBrNAPUGwvAD9J4Ej5zyx4IXP/gfpgan-large.png",
"scale": 2,
"version": "v1.4"
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_Sfn**********************************
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 lucataco/gfpgan using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"lucataco/gfpgan:66a607f2c8ee93966fb2759b0bb93f48a707f46d2f75df5d66db73d3b5d8337d",
{
input: {
img: "https://replicate.delivery/pbxt/JHZ4Fx3YeSIMGk8x0uPROPKZBrNAPUGwvAD9J4Ej5zyx4IXP/gfpgan-large.png",
scale: 2,
version: "v1.4"
}
}
);
// 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_Sfn**********************************
This is your API token. Keep it to yourself.
import replicate
Run lucataco/gfpgan using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"lucataco/gfpgan:66a607f2c8ee93966fb2759b0bb93f48a707f46d2f75df5d66db73d3b5d8337d",
input={
"img": "https://replicate.delivery/pbxt/JHZ4Fx3YeSIMGk8x0uPROPKZBrNAPUGwvAD9J4Ej5zyx4IXP/gfpgan-large.png",
"scale": 2,
"version": "v1.4"
}
)
# 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_Sfn**********************************
This is your API token. Keep it to yourself.
Run lucataco/gfpgan 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": "lucataco/gfpgan:66a607f2c8ee93966fb2759b0bb93f48a707f46d2f75df5d66db73d3b5d8337d",
"input": {
"img": "https://replicate.delivery/pbxt/JHZ4Fx3YeSIMGk8x0uPROPKZBrNAPUGwvAD9J4Ej5zyx4IXP/gfpgan-large.png",
"scale": 2,
"version": "v1.4"
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "6cd6kvtbmdyad5apnzo7ckk23m",
"model": "lucataco/gfpgan",
"version": "66a607f2c8ee93966fb2759b0bb93f48a707f46d2f75df5d66db73d3b5d8337d",
"input": {
"img": "https://replicate.delivery/pbxt/JHZ4Fx3YeSIMGk8x0uPROPKZBrNAPUGwvAD9J4Ej5zyx4IXP/gfpgan-large.png",
"scale": 2,
"version": "v1.4"
},
"logs": "/tmp/tmp1oircjeggfpgan-large.png v1.4 2.0 0.5",
"output": "https://replicate.delivery/pbxt/YoICefceadfiwScwffqng14VeJS55Q6Y8UKWnBbgd0nzVCErIA/out..png",
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2023-08-02T21:48:23.822379Z",
"started_at": "2023-08-02T21:48:23.777534Z",
"completed_at": "2023-08-02T21:48:28.816744Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/6cd6kvtbmdyad5apnzo7ckk23m/cancel",
"get": "https://api.replicate.com/v1/predictions/6cd6kvtbmdyad5apnzo7ckk23m"
},
"metrics": {
"predict_time": 5.03921,
"total_time": 4.994365
}
}
