typefile
{
"image": "https://replicate.delivery/pbxt/IYTqGFhESyTxWX9AgFABgMdfStkVTkDZrNGCqhS6VCijFLgj/ai2d-demo.jpg",
"model_name": "ai2d",
"text": "What does the label 15 represent? (1) lava (2) core (3) tunnel (4) ash cloud"
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_5aa**********************************
This is your API token. Keep it to yourself.
import Replicate from "replicate";
const replicate = new Replicate({
auth: process.env.REPLICATE_API_TOKEN,
});
Run cjwbw/pix2struct using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"cjwbw/pix2struct:e32d77481424b47e7959836638b62082d8528b0c66a3a30eedca3970aaf786e7",
{
input: {
image: "https://replicate.delivery/pbxt/IYTqGFhESyTxWX9AgFABgMdfStkVTkDZrNGCqhS6VCijFLgj/ai2d-demo.jpg",
model_name: "ai2d",
text: "What does the label 15 represent? (1) lava (2) core (3) tunnel (4) ash cloud"
}
}
);
console.log(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_5aa**********************************
This is your API token. Keep it to yourself.
import replicate
Run cjwbw/pix2struct using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"cjwbw/pix2struct:e32d77481424b47e7959836638b62082d8528b0c66a3a30eedca3970aaf786e7",
input={
"image": "https://replicate.delivery/pbxt/IYTqGFhESyTxWX9AgFABgMdfStkVTkDZrNGCqhS6VCijFLgj/ai2d-demo.jpg",
"model_name": "ai2d",
"text": "What does the label 15 represent? (1) lava (2) core (3) tunnel (4) ash cloud"
}
)
print(output)
To learn more, take a look at the guide on getting started with Python.
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_5aa**********************************
This is your API token. Keep it to yourself.
Run cjwbw/pix2struct 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": "cjwbw/pix2struct:e32d77481424b47e7959836638b62082d8528b0c66a3a30eedca3970aaf786e7",
"input": {
"image": "https://replicate.delivery/pbxt/IYTqGFhESyTxWX9AgFABgMdfStkVTkDZrNGCqhS6VCijFLgj/ai2d-demo.jpg",
"model_name": "ai2d",
"text": "What does the label 15 represent? (1) lava (2) core (3) tunnel (4) ash cloud"
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
ash cloud
{
"id": "xmbwph5cunhytna3aacbbpofcq",
"model": "cjwbw/pix2struct",
"version": "e32d77481424b47e7959836638b62082d8528b0c66a3a30eedca3970aaf786e7",
"input": {
"image": "https://replicate.delivery/pbxt/IYTqGFhESyTxWX9AgFABgMdfStkVTkDZrNGCqhS6VCijFLgj/ai2d-demo.jpg",
"model_name": "ai2d",
"text": "What does the label 15 represent? (1) lava (2) core (3) tunnel (4) ash cloud"
},
"logs": "Adding prompt for VQA model: 'What does the label 15 represent? (1) lava (2) core (3) tunnel (4) ash cloud'\nA decoder-only architecture is being used, but right-padding was detected! For correct generation results, please set `padding_side='left'` when initializing the tokenizer.",
"output": "ash cloud",
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2023-03-28T22:58:10.354318Z",
"started_at": "2023-03-28T22:58:10.454601Z",
"completed_at": "2023-03-28T22:58:13.077041Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/xmbwph5cunhytna3aacbbpofcq/cancel",
"get": "https://api.replicate.com/v1/predictions/xmbwph5cunhytna3aacbbpofcq"
},
"metrics": {
"predict_time": 2.62244,
"total_time": 2.722723
}
}