typefile
{
"image": "https://replicate.delivery/pbxt/KDMkjS4SpsGieAxMdkBUNWT5zFI8BvAU4XjiyI2xmLny3skZ/Buffalo%20Bank%20Buffalo%2C%20New%20York%2C%20circa%201908.%20Erie%20County%20Savings%20Bank%2C%20Niagara%20Street.jpg",
"model_size": "large"
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_3gZ**********************************
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 piddnad/ddcolor using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"piddnad/ddcolor:ca494ba129e44e45f661d6ece83c4c98a9a7c774309beca01429b58fce8aa695",
{
input: {
image: "https://replicate.delivery/pbxt/KDMkjS4SpsGieAxMdkBUNWT5zFI8BvAU4XjiyI2xmLny3skZ/Buffalo%20Bank%20Buffalo%2C%20New%20York%2C%20circa%201908.%20Erie%20County%20Savings%20Bank%2C%20Niagara%20Street.jpg",
model_size: "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_3gZ**********************************
This is your API token. Keep it to yourself.
import replicate
Run piddnad/ddcolor using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"piddnad/ddcolor:ca494ba129e44e45f661d6ece83c4c98a9a7c774309beca01429b58fce8aa695",
input={
"image": "https://replicate.delivery/pbxt/KDMkjS4SpsGieAxMdkBUNWT5zFI8BvAU4XjiyI2xmLny3skZ/Buffalo%20Bank%20Buffalo%2C%20New%20York%2C%20circa%201908.%20Erie%20County%20Savings%20Bank%2C%20Niagara%20Street.jpg",
"model_size": "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_3gZ**********************************
This is your API token. Keep it to yourself.
Run piddnad/ddcolor 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": "piddnad/ddcolor:ca494ba129e44e45f661d6ece83c4c98a9a7c774309beca01429b58fce8aa695",
"input": {
"image": "https://replicate.delivery/pbxt/KDMkjS4SpsGieAxMdkBUNWT5zFI8BvAU4XjiyI2xmLny3skZ/Buffalo%20Bank%20Buffalo%2C%20New%20York%2C%20circa%201908.%20Erie%20County%20Savings%20Bank%2C%20Niagara%20Street.jpg",
"model_size": "large"
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "pkxytzdbkuach644xwzyouk5fu",
"model": "piddnad/ddcolor",
"version": "ca494ba129e44e45f661d6ece83c4c98a9a7c774309beca01429b58fce8aa695",
"input": {
"image": "https://replicate.delivery/pbxt/KDMkjS4SpsGieAxMdkBUNWT5zFI8BvAU4XjiyI2xmLny3skZ/Buffalo%20Bank%20Buffalo%2C%20New%20York%2C%20circa%201908.%20Erie%20County%20Savings%20Bank%2C%20Niagara%20Street.jpg",
"model_size": "large"
},
"logs": "",
"output": "https://replicate.delivery/pbxt/ZumJoHeMlA0WVyesmCZlkoKtNPakny5ariWAaXR3aEhvflXkA/out.png",
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2024-01-12T17:59:09.59128Z",
"started_at": "2024-01-12T17:59:09.707942Z",
"completed_at": "2024-01-12T17:59:12.626699Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/pkxytzdbkuach644xwzyouk5fu/cancel",
"get": "https://api.replicate.com/v1/predictions/pkxytzdbkuach644xwzyouk5fu"
},
"metrics": {
"predict_time": 2.918757,
"total_time": 3.035419
}
}
