typefile
{
"input_image": "https://cdn.fishki.net/upload/post/2019/08/01/3047343/tn/d333f85d3bcfccf832e70b5e7c155077-01.jpg"
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_EAW**********************************
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 kitaef/mytestmodel using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"kitaef/mytestmodel:a0ebe82aad0744fbc8f6964143760ed306af3864daa4b62a776b656636c1f191",
{
input: {
input_image: "https://cdn.fishki.net/upload/post/2019/08/01/3047343/tn/d333f85d3bcfccf832e70b5e7c155077-01.jpg"
}
}
);
// 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_EAW**********************************
This is your API token. Keep it to yourself.
import replicate
Run kitaef/mytestmodel using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"kitaef/mytestmodel:a0ebe82aad0744fbc8f6964143760ed306af3864daa4b62a776b656636c1f191",
input={
"input_image": "https://cdn.fishki.net/upload/post/2019/08/01/3047343/tn/d333f85d3bcfccf832e70b5e7c155077-01.jpg"
}
)
# 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_EAW**********************************
This is your API token. Keep it to yourself.
Run kitaef/mytestmodel 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": "kitaef/mytestmodel:a0ebe82aad0744fbc8f6964143760ed306af3864daa4b62a776b656636c1f191",
"input": {
"input_image": "https://cdn.fishki.net/upload/post/2019/08/01/3047343/tn/d333f85d3bcfccf832e70b5e7c155077-01.jpg"
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "9wxj8c2adsrgg0cf8zt9c1v99c",
"model": "kitaef/mytestmodel",
"version": "a0ebe82aad0744fbc8f6964143760ed306af3864daa4b62a776b656636c1f191",
"input": {
"input_image": "https://cdn.fishki.net/upload/post/2019/08/01/3047343/tn/d333f85d3bcfccf832e70b5e7c155077-01.jpg"
},
"logs": "0%| | 0/20 [00:00<?, ?it/s]/root/.pyenv/versions/3.11.9/lib/python3.11/site-packages/torch/nn/modules/conv.py:456: UserWarning: Plan failed with a cudnnException: CUDNN_BACKEND_EXECUTION_PLAN_DESCRIPTOR: cudnnFinalize Descriptor Failed cudnn_status: CUDNN_STATUS_NOT_SUPPORTED (Triggered internally at ../aten/src/ATen/native/cudnn/Conv_v8.cpp:919.)\nreturn F.conv2d(input, weight, bias, self.stride,\n 5%|▌ | 1/20 [00:02<00:41, 2.19s/it]\n 10%|█ | 2/20 [00:02<00:20, 1.16s/it]\n 15%|█▌ | 3/20 [00:03<00:14, 1.20it/s]\n 20%|██ | 4/20 [00:03<00:10, 1.48it/s]\n 25%|██▌ | 5/20 [00:03<00:08, 1.70it/s]\n 30%|███ | 6/20 [00:04<00:07, 1.86it/s]\n 35%|███▌ | 7/20 [00:04<00:06, 1.98it/s]\n 40%|████ | 8/20 [00:05<00:05, 2.07it/s]\n 45%|████▌ | 9/20 [00:05<00:05, 2.14it/s]\n 50%|█████ | 10/20 [00:06<00:04, 2.18it/s]\n 55%|█████▌ | 11/20 [00:06<00:04, 2.21it/s]\n 60%|██████ | 12/20 [00:06<00:03, 2.24it/s]\n 65%|██████▌ | 13/20 [00:07<00:03, 2.25it/s]\n 70%|███████ | 14/20 [00:07<00:02, 2.26it/s]\n 75%|███████▌ | 15/20 [00:08<00:02, 2.27it/s]\n 80%|████████ | 16/20 [00:08<00:01, 2.28it/s]\n 85%|████████▌ | 17/20 [00:09<00:01, 2.28it/s]\n 90%|█████████ | 18/20 [00:09<00:00, 2.28it/s]\n 95%|█████████▌| 19/20 [00:10<00:00, 2.29it/s]\n100%|██████████| 20/20 [00:10<00:00, 2.29it/s]\n100%|██████████| 20/20 [00:10<00:00, 1.91it/s]",
"output": "https://replicate.delivery/pbxt/8oFfucYpBYQWOip5ngf6xzrY9DnC5GcIY8V1G2gMQgIPtPxSA/output.jpg",
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2024-05-05T08:52:23.278Z",
"started_at": "2024-05-05T08:54:21.845397Z",
"completed_at": "2024-05-05T08:54:40.024484Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/9wxj8c2adsrgg0cf8zt9c1v99c/cancel",
"get": "https://api.replicate.com/v1/predictions/9wxj8c2adsrgg0cf8zt9c1v99c",
"web": "https://replicate.com/p/9wxj8c2adsrgg0cf8zt9c1v99c"
},
"metrics": {
"predict_time": 18.179087,
"total_time": 136.746484
}
}
