typefile
{
"image": "https://replicate.delivery/mgxm/ceba852d-1e52-4004-ae8b-86869790dbc3/beautiful-scenery-wallpapers-moonlight-beauty.jpg",
"question": "what is standing on the rock?",
"task": "visual_question_answering"
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_GU7**********************************
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/ceba852d-1e52-4004-ae8b-86869790dbc3/beautiful-scenery-wallpapers-moonlight-beauty.jpg",
question: "what is standing on the rock?",
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_GU7**********************************
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/ceba852d-1e52-4004-ae8b-86869790dbc3/beautiful-scenery-wallpapers-moonlight-beauty.jpg",
"question": "what is standing on the rock?",
"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_GU7**********************************
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/ceba852d-1e52-4004-ae8b-86869790dbc3/beautiful-scenery-wallpapers-moonlight-beauty.jpg",
"question": "what is standing on the rock?",
"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: deer",
"typeMismatch": false
}
},
"inferred": false,
"outputValue": {
"text": "Answer: deer"
},
"typeMismatch": false
}{
"id": "mojxr2cdczexzjxsvjuvbummqi",
"model": "salesforce/blip",
"version": "5a977fcb091363cc3938cc870c9f6242f5938267040e6837373387bb90d23099",
"input": {
"image": "https://replicate.delivery/mgxm/ceba852d-1e52-4004-ae8b-86869790dbc3/beautiful-scenery-wallpapers-moonlight-beauty.jpg",
"question": "what is standing on the rock?",
"task": "visual_question_answering"
},
"logs": "",
"output": [
{
"text": "Answer: deer"
}
],
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2022-02-09T00:45:18.298758Z",
"started_at": "2022-02-09T00:45:18.535168Z",
"completed_at": "2022-02-09T00:45:19.451289Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/mojxr2cdczexzjxsvjuvbummqi/cancel",
"get": "https://api.replicate.com/v1/predictions/mojxr2cdczexzjxsvjuvbummqi"
},
"metrics": {
"predict_time": 0.916121,
"total_time": 1.152531
}
}