typefile
{
"img": "https://replicate.delivery/mgxm/76b55984-30a4-437e-86bc-701756219c23/%D7%A6%D7%99%D7%9C%D7%95%D7%9D_%D7%9E%D7%A1%D7%9A_2022-09-20_103613.png",
"scale": 2,
"version": "v1.4"
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_Pqk**********************************
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/mgxm/76b55984-30a4-437e-86bc-701756219c23/%D7%A6%D7%99%D7%9C%D7%95%D7%9D_%D7%9E%D7%A1%D7%9A_2022-09-20_103613.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_Pqk**********************************
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/mgxm/76b55984-30a4-437e-86bc-701756219c23/%D7%A6%D7%99%D7%9C%D7%95%D7%9D_%D7%9E%D7%A1%D7%9A_2022-09-20_103613.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_Pqk**********************************
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/mgxm/76b55984-30a4-437e-86bc-701756219c23/%D7%A6%D7%99%D7%9C%D7%95%D7%9D_%D7%9E%D7%A1%D7%9A_2022-09-20_103613.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.
Loading...
{
"id": "yax4famc4fbpfmlcpxqvuxtiya",
"model": "tencentarc/gfpgan",
"version": "9283608cc6b7be6b65a8e44983db012355fde4132009bf99d976b2f0896856a3",
"input": {
"img": "https://replicate.delivery/mgxm/76b55984-30a4-437e-86bc-701756219c23/%D7%A6%D7%99%D7%9C%D7%95%D7%9D_%D7%9E%D7%A1%D7%9A_2022-09-20_103613.png",
"scale": 2,
"version": "v1.4"
},
"logs": "/tmp/tmpvawgtowk%D7%A6%D7%99%D7%9C%D7%95%D7%9D_%D7%9E%D7%A1%D7%9A_2022-09-20_103613.png v1.4 2.0 0.5",
"output": "https://replicate.com/api/models/tencentarc/gfpgan/files/9a3cec27-543e-44c5-aeae-8e896458802e/out.png",
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2022-09-20T07:42:14.518638Z",
"started_at": "2022-09-20T07:42:14.746093Z",
"completed_at": "2022-09-20T07:42:17.351947Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/yax4famc4fbpfmlcpxqvuxtiya/cancel",
"get": "https://api.replicate.com/v1/predictions/yax4famc4fbpfmlcpxqvuxtiya"
},
"metrics": {
"predict_time": 2.605854,
"total_time": 2.833309
}
}