typefile
{
"image": "https://replicate.delivery/pbxt/IMaOTdBMcd6knNIdJ8zRCoaXme6ca7NtcWHop1dkLjWDuAsB/frog.png",
"task": "real_sr"
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_CxD**********************************
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 mv-lab/swin2sr using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"mv-lab/swin2sr:a01b0512004918ca55d02e554914a9eca63909fa83a29ff0f115c78a7045574f",
{
input: {
image: "https://replicate.delivery/pbxt/IMaOTdBMcd6knNIdJ8zRCoaXme6ca7NtcWHop1dkLjWDuAsB/frog.png",
task: "real_sr"
}
}
);
// 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_CxD**********************************
This is your API token. Keep it to yourself.
import replicate
Run mv-lab/swin2sr using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"mv-lab/swin2sr:a01b0512004918ca55d02e554914a9eca63909fa83a29ff0f115c78a7045574f",
input={
"image": "https://replicate.delivery/pbxt/IMaOTdBMcd6knNIdJ8zRCoaXme6ca7NtcWHop1dkLjWDuAsB/frog.png",
"task": "real_sr"
}
)
# 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_CxD**********************************
This is your API token. Keep it to yourself.
Run mv-lab/swin2sr 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": "mv-lab/swin2sr:a01b0512004918ca55d02e554914a9eca63909fa83a29ff0f115c78a7045574f",
"input": {
"image": "https://replicate.delivery/pbxt/IMaOTdBMcd6knNIdJ8zRCoaXme6ca7NtcWHop1dkLjWDuAsB/frog.png",
"task": "real_sr"
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
Loading...
{
"id": "agb3t34akrc6fjr7oj5y2jla74",
"model": "mv-lab/swin2sr",
"version": "a01b0512004918ca55d02e554914a9eca63909fa83a29ff0f115c78a7045574f",
"input": {
"image": "https://replicate.delivery/pbxt/IMaOTdBMcd6knNIdJ8zRCoaXme6ca7NtcWHop1dkLjWDuAsB/frog.png",
"task": "real_sr"
},
"logs": "",
"output": "https://replicate.delivery/pbxt/KUIcw7v0GKZtDByjISRnRrcMer7J80cikHOCcnvdnefhFcChA/out.png",
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2023-02-23T09:15:27.168145Z",
"started_at": "2023-02-23T09:15:27.243759Z",
"completed_at": "2023-02-23T09:15:29.660217Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/agb3t34akrc6fjr7oj5y2jla74/cancel",
"get": "https://api.replicate.com/v1/predictions/agb3t34akrc6fjr7oj5y2jla74"
},
"metrics": {
"predict_time": 2.416458,
"total_time": 2.492072
}
}