typefile
{
"image": "https://replicate.delivery/mgxm/c09d33a6-51c7-452d-82d8-5b647c40a839/3018.jpeg",
"model_type": "medium"
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_SGI**********************************
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 vis-opt-group/sci using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"vis-opt-group/sci:8755e56955d1fe51fc5f146612124f2f616abc2b76f46163afe48918277c1039",
{
input: {
image: "https://replicate.delivery/mgxm/c09d33a6-51c7-452d-82d8-5b647c40a839/3018.jpeg",
model_type: "medium"
}
}
);
// 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_SGI**********************************
This is your API token. Keep it to yourself.
import replicate
Run vis-opt-group/sci using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"vis-opt-group/sci:8755e56955d1fe51fc5f146612124f2f616abc2b76f46163afe48918277c1039",
input={
"image": "https://replicate.delivery/mgxm/c09d33a6-51c7-452d-82d8-5b647c40a839/3018.jpeg",
"model_type": "medium"
}
)
# 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_SGI**********************************
This is your API token. Keep it to yourself.
Run vis-opt-group/sci 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": "vis-opt-group/sci:8755e56955d1fe51fc5f146612124f2f616abc2b76f46163afe48918277c1039",
"input": {
"image": "https://replicate.delivery/mgxm/c09d33a6-51c7-452d-82d8-5b647c40a839/3018.jpeg",
"model_type": "medium"
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "4bfe57xrubh67pv75hy63iifn4",
"model": "vis-opt-group/sci",
"version": "8755e56955d1fe51fc5f146612124f2f616abc2b76f46163afe48918277c1039",
"input": {
"image": "https://replicate.delivery/mgxm/c09d33a6-51c7-452d-82d8-5b647c40a839/3018.jpeg",
"model_type": "medium"
},
"logs": "",
"output": "https://replicate.delivery/mgxm/ea9b3fed-4e18-45e7-9f51-c4bada57a519/output.png",
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2022-06-09T13:47:20.248079Z",
"started_at": "2022-06-09T13:47:21.363364Z",
"completed_at": "2022-06-09T13:47:21.363366Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/4bfe57xrubh67pv75hy63iifn4/cancel",
"get": "https://api.replicate.com/v1/predictions/4bfe57xrubh67pv75hy63iifn4"
},
"metrics": {
"predict_time": 0.000002,
"total_time": 1.115287
}
}
