typefile
{
"image": "https://replicate.delivery/pbxt/KK4WleeNoUgjF8PXPPLBLbpBUgRwsoS9EGdBMpwhs0PfLuU0/low-quality-landscape.jpg",
"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_asW**********************************
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 jingyunliang/swinir using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"jingyunliang/swinir:660d922d33153019e8c263a3bba265de882e7f4f70396546b6c9c8f9d47a021a",
{
input: {
image: "https://replicate.delivery/pbxt/KK4WleeNoUgjF8PXPPLBLbpBUgRwsoS9EGdBMpwhs0PfLuU0/low-quality-landscape.jpg",
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_asW**********************************
This is your API token. Keep it to yourself.
import replicate
Run jingyunliang/swinir using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"jingyunliang/swinir:660d922d33153019e8c263a3bba265de882e7f4f70396546b6c9c8f9d47a021a",
input={
"image": "https://replicate.delivery/pbxt/KK4WleeNoUgjF8PXPPLBLbpBUgRwsoS9EGdBMpwhs0PfLuU0/low-quality-landscape.jpg",
"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_asW**********************************
This is your API token. Keep it to yourself.
Run jingyunliang/swinir 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": "jingyunliang/swinir:660d922d33153019e8c263a3bba265de882e7f4f70396546b6c9c8f9d47a021a",
"input": {
"image": "https://replicate.delivery/pbxt/KK4WleeNoUgjF8PXPPLBLbpBUgRwsoS9EGdBMpwhs0PfLuU0/low-quality-landscape.jpg",
"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.
Loading...
{
"id": "xnboddbbsmatzzhuis26tconxa",
"model": "jingyunliang/swinir",
"version": "660d922d33153019e8c263a3bba265de882e7f4f70396546b6c9c8f9d47a021a",
"input": {
"image": "https://replicate.delivery/pbxt/KK4WleeNoUgjF8PXPPLBLbpBUgRwsoS9EGdBMpwhs0PfLuU0/low-quality-landscape.jpg",
"jpeg": 40,
"noise": 15,
"task_type": "Real-World Image Super-Resolution-Large"
},
"logs": "",
"output": "https://replicate.delivery/pbxt/EthhfyIboFxtQC67kjwAHCiglfMjPHuaHNHUNXQcgRRxgBSSA/out.png",
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2024-01-31T15:24:29.581795Z",
"started_at": "2024-01-31T15:24:29.598198Z",
"completed_at": "2024-01-31T15:24:34.043267Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/xnboddbbsmatzzhuis26tconxa/cancel",
"get": "https://api.replicate.com/v1/predictions/xnboddbbsmatzzhuis26tconxa"
},
"metrics": {
"predict_time": 4.445069,
"total_time": 4.461472
}
}