typefile
{
"image": "https://replicate.delivery/mgxm/efe546ab-97e8-417c-9716-33a9ff8f7514/beautiful-scenery-wallpapers-moonlight-beauty.jpg",
"question": "what is in the lake?",
"task": "visual_question_answering"
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_GKp**********************************
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/efe546ab-97e8-417c-9716-33a9ff8f7514/beautiful-scenery-wallpapers-moonlight-beauty.jpg",
question: "what is in the lake?",
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_GKp**********************************
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/efe546ab-97e8-417c-9716-33a9ff8f7514/beautiful-scenery-wallpapers-moonlight-beauty.jpg",
"question": "what is in the lake?",
"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_GKp**********************************
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/efe546ab-97e8-417c-9716-33a9ff8f7514/beautiful-scenery-wallpapers-moonlight-beauty.jpg",
"question": "what is in the lake?",
"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: swans",
"typeMismatch": false
}
},
"inferred": false,
"outputValue": {
"text": "Answer: swans"
},
"typeMismatch": false
}{
"id": "r4m2l3fcjzdk5pcaw3yxddi7su",
"model": "salesforce/blip",
"version": "5a977fcb091363cc3938cc870c9f6242f5938267040e6837373387bb90d23099",
"input": {
"image": "https://replicate.delivery/mgxm/efe546ab-97e8-417c-9716-33a9ff8f7514/beautiful-scenery-wallpapers-moonlight-beauty.jpg",
"question": "what is in the lake?",
"task": "visual_question_answering"
},
"logs": "",
"output": [
{
"text": "Answer: swans"
}
],
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2022-02-09T00:45:37.340433Z",
"started_at": "2022-02-09T00:45:37.637982Z",
"completed_at": "2022-02-09T00:45:38.603992Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/r4m2l3fcjzdk5pcaw3yxddi7su/cancel",
"get": "https://api.replicate.com/v1/predictions/r4m2l3fcjzdk5pcaw3yxddi7su"
},
"metrics": {
"predict_time": 0.96601,
"total_time": 1.263559
}
}