typefile
{
"image": "https://replicate.delivery/mgxm/32e7126a-dd86-4e8c-8706-5855b8b69cf1/demo.jpg",
"question": "where is the woman?",
"task": "visual_question_answering"
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_3Ds**********************************
This is your API token. Keep it to yourself.
import Replicate from "replicate";
const replicate = new Replicate({
auth: process.env.REPLICATE_API_TOKEN,
});
Run salesforce/blip using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"salesforce/blip:5a977fcb091363cc3938cc870c9f6242f5938267040e6837373387bb90d23099",
{
input: {
image: "https://replicate.delivery/mgxm/32e7126a-dd86-4e8c-8706-5855b8b69cf1/demo.jpg",
question: "where is the woman?",
task: "visual_question_answering"
}
}
);
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_3Ds**********************************
This is your API token. Keep it to yourself.
import replicate
Run salesforce/blip using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"salesforce/blip:5a977fcb091363cc3938cc870c9f6242f5938267040e6837373387bb90d23099",
input={
"image": "https://replicate.delivery/mgxm/32e7126a-dd86-4e8c-8706-5855b8b69cf1/demo.jpg",
"question": "where is the woman?",
"task": "visual_question_answering"
}
)
# The salesforce/blip model can stream output as it's running.
# The predict method returns an iterator, and you can iterate over that output.
for item in output:
# https://replicate.com/salesforce/blip/api#output-schema
print(item)
To learn more, take a look at the guide on getting started with Python.
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_3Ds**********************************
This is your API token. Keep it to yourself.
Run salesforce/blip 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": "salesforce/blip:5a977fcb091363cc3938cc870c9f6242f5938267040e6837373387bb90d23099",
"input": {
"image": "https://replicate.delivery/mgxm/32e7126a-dd86-4e8c-8706-5855b8b69cf1/demo.jpg",
"question": "where is the woman?",
"task": "visual_question_answering"
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"outputType": "object",
"properties": {
"text": {
"outputType": "text",
"inferred": false,
"outputValue": "Answer: on beach",
"typeMismatch": false
}
},
"inferred": false,
"outputValue": {
"text": "Answer: on beach"
},
"typeMismatch": false
}{
"id": "kt5yvsmuhfb7bfc5gnkzor2i3y",
"model": "salesforce/blip",
"version": "5a977fcb091363cc3938cc870c9f6242f5938267040e6837373387bb90d23099",
"input": {
"image": "https://replicate.delivery/mgxm/32e7126a-dd86-4e8c-8706-5855b8b69cf1/demo.jpg",
"question": "where is the woman?",
"task": "visual_question_answering"
},
"logs": "",
"output": [
{
"text": "Answer: on beach"
}
],
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2022-02-08T00:43:52.544698Z",
"started_at": "2022-02-08T00:46:19.481787Z",
"completed_at": "2022-02-08T00:46:28.564016Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/kt5yvsmuhfb7bfc5gnkzor2i3y/cancel",
"get": "https://api.replicate.com/v1/predictions/kt5yvsmuhfb7bfc5gnkzor2i3y"
},
"metrics": {
"predict_time": 9.082229,
"total_time": 156.019318
}
}