typefile
{
"image": "https://replicate.delivery/pbxt/Mg4tpb5K4yrjgedQMXWHszOPsLR6XJiTJgV8NZrH4PAA3R8Y/9a064907.png",
"load_size": 1536,
"preprocess": "scale_width"
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_f6T**********************************
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 gstranger/digi2000 using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"gstranger/digi2000:79fc8f45d4542b7fa0990ddd8baff7d6ec11ce3f5fe6612af7482993a94e866d",
{
input: {
image: "https://replicate.delivery/pbxt/Mg4tpb5K4yrjgedQMXWHszOPsLR6XJiTJgV8NZrH4PAA3R8Y/9a064907.png",
load_size: 1536,
preprocess: "scale_width"
}
}
);
// 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_f6T**********************************
This is your API token. Keep it to yourself.
import replicate
Run gstranger/digi2000 using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"gstranger/digi2000:79fc8f45d4542b7fa0990ddd8baff7d6ec11ce3f5fe6612af7482993a94e866d",
input={
"image": "https://replicate.delivery/pbxt/Mg4tpb5K4yrjgedQMXWHszOPsLR6XJiTJgV8NZrH4PAA3R8Y/9a064907.png",
"load_size": 1536,
"preprocess": "scale_width"
}
)
# 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_f6T**********************************
This is your API token. Keep it to yourself.
Run gstranger/digi2000 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": "gstranger/digi2000:79fc8f45d4542b7fa0990ddd8baff7d6ec11ce3f5fe6612af7482993a94e866d",
"input": {
"image": "https://replicate.delivery/pbxt/Mg4tpb5K4yrjgedQMXWHszOPsLR6XJiTJgV8NZrH4PAA3R8Y/9a064907.png",
"load_size": 1536,
"preprocess": "scale_width"
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "vghmtf52g5rg80cnmsqbev62sr",
"model": "gstranger/digi2000",
"version": "79fc8f45d4542b7fa0990ddd8baff7d6ec11ce3f5fe6612af7482993a94e866d",
"input": {
"image": "https://replicate.delivery/pbxt/Mg4tpb5K4yrjgedQMXWHszOPsLR6XJiTJgV8NZrH4PAA3R8Y/9a064907.png",
"load_size": 1536,
"preprocess": "scale_width"
},
"logs": "",
"output": "https://replicate.delivery/czjl/fglrpXIU5qXUF60aS3IyoD2ITIiZmSlSSPVHYibiGxMAEzMKA/output.png",
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2025-03-17T23:27:03.297Z",
"started_at": "2025-03-17T23:27:29.575456Z",
"completed_at": "2025-03-17T23:28:00.756109Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/vghmtf52g5rg80cnmsqbev62sr/cancel",
"get": "https://api.replicate.com/v1/predictions/vghmtf52g5rg80cnmsqbev62sr",
"stream": "https://stream.replicate.com/v1/files/fddq-ktke6u4kohtt6uhqyz5tl25tyo3nkjio4aszpkqjcqlnj5mgynpq",
"web": "https://replicate.com/p/vghmtf52g5rg80cnmsqbev62sr"
},
"metrics": {
"predict_time": 31.180652886,
"total_time": 57.459109
}
}
