typefile
{
"image": "https://replicate.delivery/pbxt/KBiA0eZ0VxcpajZa3dhqcbB9Kgr7ZzgEeZPCXt9uuogmW72P/chip.png",
"jpeg": 40,
"noise": 15,
"task_type": "Real-World Image Super-Resolution-Large"
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_Bqq**********************************
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 replicatemodel/swinir_t4 using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"replicatemodel/swinir_t4:3ca651c518dee29c6c2a5a741c786de942d8e1007f79f4c47b4ae632a49950b3",
{
input: {
image: "https://replicate.delivery/pbxt/KBiA0eZ0VxcpajZa3dhqcbB9Kgr7ZzgEeZPCXt9uuogmW72P/chip.png",
jpeg: 40,
noise: 15,
task_type: "Real-World Image Super-Resolution-Large"
}
}
);
// 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_Bqq**********************************
This is your API token. Keep it to yourself.
import replicate
Run replicatemodel/swinir_t4 using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"replicatemodel/swinir_t4:3ca651c518dee29c6c2a5a741c786de942d8e1007f79f4c47b4ae632a49950b3",
input={
"image": "https://replicate.delivery/pbxt/KBiA0eZ0VxcpajZa3dhqcbB9Kgr7ZzgEeZPCXt9uuogmW72P/chip.png",
"jpeg": 40,
"noise": 15,
"task_type": "Real-World Image Super-Resolution-Large"
}
)
# 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_Bqq**********************************
This is your API token. Keep it to yourself.
Run replicatemodel/swinir_t4 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": "replicatemodel/swinir_t4:3ca651c518dee29c6c2a5a741c786de942d8e1007f79f4c47b4ae632a49950b3",
"input": {
"image": "https://replicate.delivery/pbxt/KBiA0eZ0VxcpajZa3dhqcbB9Kgr7ZzgEeZPCXt9uuogmW72P/chip.png",
"jpeg": 40,
"noise": 15,
"task_type": "Real-World Image Super-Resolution-Large"
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "xbg5ogjbq6dlornfhi57yybn2e",
"model": "replicatemodel/swinir_t4",
"version": "3ca651c518dee29c6c2a5a741c786de942d8e1007f79f4c47b4ae632a49950b3",
"input": {
"image": "https://replicate.delivery/pbxt/KBiA0eZ0VxcpajZa3dhqcbB9Kgr7ZzgEeZPCXt9uuogmW72P/chip.png",
"jpeg": 40,
"noise": 15,
"task_type": "Real-World Image Super-Resolution-Large"
},
"logs": "",
"output": "https://replicate.delivery/pbxt/FCx3Ju4loaZ3Pd1g36jCWOMotllFAMSOfSzHJTIfMsNNtQKSA/out.png",
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2024-01-08T02:06:15.793821Z",
"started_at": "2024-01-08T02:09:08.812744Z",
"completed_at": "2024-01-08T02:09:17.516788Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/xbg5ogjbq6dlornfhi57yybn2e/cancel",
"get": "https://api.replicate.com/v1/predictions/xbg5ogjbq6dlornfhi57yybn2e"
},
"metrics": {
"predict_time": 8.704044,
"total_time": 181.722967
}
}
