typefile
{
"face_enhance": true,
"image": "https://replicate.delivery/pbxt/JM6ZAcEVtcieXxez7qCZG8E4pnq7wGH1YX7YgJH9F5sTpsFc/keanu.jpeg",
"scale": 4
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_dqT**********************************
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 anotherjesse/real-esrgan-a40 using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"anotherjesse/real-esrgan-a40:c966e6e867e53e4a5fe11f6c73d9f7a71d30b709814a37ccc373825bfb4c7c8a",
{
input: {
face_enhance: true,
image: "https://replicate.delivery/pbxt/JM6ZAcEVtcieXxez7qCZG8E4pnq7wGH1YX7YgJH9F5sTpsFc/keanu.jpeg",
scale: 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_dqT**********************************
This is your API token. Keep it to yourself.
import replicate
Run anotherjesse/real-esrgan-a40 using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"anotherjesse/real-esrgan-a40:c966e6e867e53e4a5fe11f6c73d9f7a71d30b709814a37ccc373825bfb4c7c8a",
input={
"face_enhance": True,
"image": "https://replicate.delivery/pbxt/JM6ZAcEVtcieXxez7qCZG8E4pnq7wGH1YX7YgJH9F5sTpsFc/keanu.jpeg",
"scale": 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_dqT**********************************
This is your API token. Keep it to yourself.
Run anotherjesse/real-esrgan-a40 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": "anotherjesse/real-esrgan-a40:c966e6e867e53e4a5fe11f6c73d9f7a71d30b709814a37ccc373825bfb4c7c8a",
"input": {
"face_enhance": true,
"image": "https://replicate.delivery/pbxt/JM6ZAcEVtcieXxez7qCZG8E4pnq7wGH1YX7YgJH9F5sTpsFc/keanu.jpeg",
"scale": 4
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "kp6lhjdba6xiiyrcru5t7l7s4e",
"model": "anotherjesse/real-esrgan-a40",
"version": "c966e6e867e53e4a5fe11f6c73d9f7a71d30b709814a37ccc373825bfb4c7c8a",
"input": {
"face_enhance": true,
"image": "https://replicate.delivery/pbxt/JM6ZAcEVtcieXxez7qCZG8E4pnq7wGH1YX7YgJH9F5sTpsFc/keanu.jpeg",
"scale": 4
},
"logs": "running with face enhancement",
"output": "https://pbxt.replicate.delivery/BMljRbe1U22lEyO8VQMUHx2h45iQTob6jZWLczs5UilW8KtIA/output.png",
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2023-08-15T16:47:40.015811Z",
"started_at": "2023-08-15T16:47:40.013906Z",
"completed_at": "2023-08-15T16:47:42.996045Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/kp6lhjdba6xiiyrcru5t7l7s4e/cancel",
"get": "https://api.replicate.com/v1/predictions/kp6lhjdba6xiiyrcru5t7l7s4e"
},
"metrics": {
"predict_time": 2.982139,
"total_time": 2.980234
}
}
