typefile
{
"img": "https://replicate.delivery/pbxt/K6A5HgMRnYFV9S0H78XQ7QQYJsg2ZPauF9s5GJCefX2h2gbl/A4%20%281%29.png",
"scale": 20,
"version": "v1.4"
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_bqz**********************************
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 tencentarc/gfpgan using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"tencentarc/gfpgan:9283608cc6b7be6b65a8e44983db012355fde4132009bf99d976b2f0896856a3",
{
input: {
img: "https://replicate.delivery/pbxt/K6A5HgMRnYFV9S0H78XQ7QQYJsg2ZPauF9s5GJCefX2h2gbl/A4%20%281%29.png",
scale: 20,
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_bqz**********************************
This is your API token. Keep it to yourself.
import replicate
Run tencentarc/gfpgan using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"tencentarc/gfpgan:9283608cc6b7be6b65a8e44983db012355fde4132009bf99d976b2f0896856a3",
input={
"img": "https://replicate.delivery/pbxt/K6A5HgMRnYFV9S0H78XQ7QQYJsg2ZPauF9s5GJCefX2h2gbl/A4%20%281%29.png",
"scale": 20,
"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_bqz**********************************
This is your API token. Keep it to yourself.
Run tencentarc/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": "tencentarc/gfpgan:9283608cc6b7be6b65a8e44983db012355fde4132009bf99d976b2f0896856a3",
"input": {
"img": "https://replicate.delivery/pbxt/K6A5HgMRnYFV9S0H78XQ7QQYJsg2ZPauF9s5GJCefX2h2gbl/A4%20%281%29.png",
"scale": 20,
"version": "v1.4"
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
Loading...
{
"id": "2jnrfzzbnppcltgqlzoyljenti",
"model": "tencentarc/gfpgan",
"version": "9283608cc6b7be6b65a8e44983db012355fde4132009bf99d976b2f0896856a3",
"input": {
"img": "https://replicate.delivery/pbxt/K6A5HgMRnYFV9S0H78XQ7QQYJsg2ZPauF9s5GJCefX2h2gbl/A4%20%281%29.png",
"scale": 20,
"version": "v1.4"
},
"logs": "/tmp/tmpi320i236A4 (1).png v1.4 20.0 0.5",
"output": "https://replicate.delivery/pbxt/mrWjzgEPtpaPGdNefoEydjFko5WQGW5J6beft8FBEuB5e2oQC/out.png",
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2023-12-23T10:52:24.686497Z",
"started_at": "2023-12-23T10:52:24.702331Z",
"completed_at": "2023-12-23T10:52:31.219652Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/2jnrfzzbnppcltgqlzoyljenti/cancel",
"get": "https://api.replicate.com/v1/predictions/2jnrfzzbnppcltgqlzoyljenti"
},
"metrics": {
"predict_time": 6.517321,
"total_time": 6.533155
}
}