typefile
{
"image": "https://replicate.delivery/pbxt/KZekorriicHO6YRgz0GH7pIhZs5lGGHe9sJgGMD71ItSTctT/image.jpeg",
"prompt": "Describe this image"
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_1UQ**********************************
This is your API token. Keep it to yourself.
import Replicate from "replicate";
const replicate = new Replicate({
auth: process.env.REPLICATE_API_TOKEN,
});
Run martintmv-git/moondream2 using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"martintmv-git/moondream2:14271a99b918262b47a6f0d8c4ef23d35ac8173e6f59314af2f5cbd2dc918183",
{
input: {
image: "https://replicate.delivery/pbxt/KZekorriicHO6YRgz0GH7pIhZs5lGGHe9sJgGMD71ItSTctT/image.jpeg",
prompt: "Describe this image"
}
}
);
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_1UQ**********************************
This is your API token. Keep it to yourself.
import replicate
Run martintmv-git/moondream2 using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"martintmv-git/moondream2:14271a99b918262b47a6f0d8c4ef23d35ac8173e6f59314af2f5cbd2dc918183",
input={
"image": "https://replicate.delivery/pbxt/KZekorriicHO6YRgz0GH7pIhZs5lGGHe9sJgGMD71ItSTctT/image.jpeg",
"prompt": "Describe this image"
}
)
# The martintmv-git/moondream2 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/martintmv-git/moondream2/api#output-schema
print(item, end="")
To learn more, take a look at the guide on getting started with Python.
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_1UQ**********************************
This is your API token. Keep it to yourself.
Run martintmv-git/moondream2 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": "martintmv-git/moondream2:14271a99b918262b47a6f0d8c4ef23d35ac8173e6f59314af2f5cbd2dc918183",
"input": {
"image": "https://replicate.delivery/pbxt/KZekorriicHO6YRgz0GH7pIhZs5lGGHe9sJgGMD71ItSTctT/image.jpeg",
"prompt": "Describe this image"
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
The image features a large, lush green field with a blue sky and white clouds scattered throughout. The field is expansive, covering a significant portion of the scene. The grass appears to be well-maintained and vibrant, creating a serene and peaceful atmosphere. The field is also dotted with a few yellow flowers, adding a touch of color to the landscape. The combination of the open space, the blue sky, and the white clouds creates a picturesque and inviting scene.
{
"id": "5c7gvftbdp62fpidh4pbkjrsky",
"model": "martintmv-git/moondream2",
"version": "14271a99b918262b47a6f0d8c4ef23d35ac8173e6f59314af2f5cbd2dc918183",
"input": {
"image": "https://replicate.delivery/pbxt/KZekorriicHO6YRgz0GH7pIhZs5lGGHe9sJgGMD71ItSTctT/image.jpeg",
"prompt": "Describe this image"
},
"logs": "",
"output": [
"",
" ",
"The ",
"image ",
"features ",
"a ",
"",
"large, ",
"lush ",
"green ",
"field ",
"with ",
"a ",
"blue ",
"sky ",
"and ",
"white ",
"clouds ",
"scattered ",
"",
"throughout. ",
"The ",
"field ",
"is ",
"",
"expansive, ",
"covering ",
"a ",
"significant ",
"portion ",
"of ",
"the ",
"",
"scene. ",
"The ",
"grass ",
"appears ",
"to ",
"be ",
"",
"",
"",
"",
"well-maintained ",
"and ",
"",
"vibrant, ",
"creating ",
"a ",
"",
"serene ",
"and ",
"peaceful ",
"",
"atmosphere. ",
"The ",
"field ",
"is ",
"also ",
"dotted ",
"with ",
"a ",
"few ",
"yellow ",
"",
"flowers, ",
"adding ",
"a ",
"touch ",
"of ",
"color ",
"to ",
"the ",
"",
"landscape. ",
"The ",
"combination ",
"of ",
"the ",
"open ",
"",
"space, ",
"the ",
"blue ",
"",
"sky, ",
"and ",
"the ",
"white ",
"clouds ",
"creates ",
"a ",
"",
"picturesque ",
"and ",
"inviting ",
"",
"",
"scene."
],
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2024-03-15T13:07:29.201499Z",
"started_at": "2024-03-15T13:07:29.24192Z",
"completed_at": "2024-03-15T13:07:31.710228Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/5c7gvftbdp62fpidh4pbkjrsky/cancel",
"get": "https://api.replicate.com/v1/predictions/5c7gvftbdp62fpidh4pbkjrsky",
"stream": "https://streaming-api.svc.us.c.replicate.net/v1/streams/d2d6k7ukkwnvdyq4hrav46b7ejxlmkeiej2gkszmepqzyzmgtaya"
},
"metrics": {
"predict_time": 2.468308,
"total_time": 2.508729
}
}