typefile
{
"beam_size": "5",
"ce_loss_scale": "0.2",
"cond_text": "Image of a",
"end_factor": "1.01",
"image": "https://replicate.delivery/mgxm/0958ab0c-8d26-45f8-a5f1-a27a1f2259cc/baby.jpg",
"max_seq_length": "15"
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_Lh9**********************************
This is your API token. Keep it to yourself.
import Replicate from "replicate";
const replicate = new Replicate({
auth: process.env.REPLICATE_API_TOKEN,
});
Run yoadtew/zero-shot-image-to-text using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"yoadtew/zero-shot-image-to-text:6d1ac11ed211454979edf969f99a6f59b363ffe9a2cb9b9c24f8d29b720ba35a",
{
input: {
beam_size: "5",
ce_loss_scale: "0.2",
cond_text: "Image of a",
end_factor: "1.01",
image: "https://replicate.delivery/mgxm/0958ab0c-8d26-45f8-a5f1-a27a1f2259cc/baby.jpg",
max_seq_length: "15"
}
}
);
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_Lh9**********************************
This is your API token. Keep it to yourself.
import replicate
Run yoadtew/zero-shot-image-to-text using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"yoadtew/zero-shot-image-to-text:6d1ac11ed211454979edf969f99a6f59b363ffe9a2cb9b9c24f8d29b720ba35a",
input={
"beam_size": "5",
"ce_loss_scale": "0.2",
"cond_text": "Image of a",
"end_factor": "1.01",
"image": "https://replicate.delivery/mgxm/0958ab0c-8d26-45f8-a5f1-a27a1f2259cc/baby.jpg",
"max_seq_length": "15"
}
)
# The yoadtew/zero-shot-image-to-text 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/yoadtew/zero-shot-image-to-text/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_Lh9**********************************
This is your API token. Keep it to yourself.
Run yoadtew/zero-shot-image-to-text 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": "yoadtew/zero-shot-image-to-text:6d1ac11ed211454979edf969f99a6f59b363ffe9a2cb9b9c24f8d29b720ba35a",
"input": {
"beam_size": "5",
"ce_loss_scale": "0.2",
"cond_text": "Image of a",
"end_factor": "1.01",
"image": "https://replicate.delivery/mgxm/0958ab0c-8d26-45f8-a5f1-a27a1f2259cc/baby.jpg",
"max_seq_length": "15"
}
}' \
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": "Best CLIP: Image of a baby sleeping in a green flower. \nBest fluency: Image of a baby sleeping in a green flower. \nBest mixed: Image of a baby.",
"typeMismatch": false
}
},
"inferred": false,
"outputValue": {
"text": "Best CLIP: Image of a baby sleeping in a green flower. \nBest fluency: Image of a baby sleeping in a green flower. \nBest mixed: Image of a baby."
},
"typeMismatch": false
}{
"id": "mhjecpjikfbfhnpypayu32dhc4",
"model": "yoadtew/zero-shot-image-to-text",
"version": "6d1ac11ed211454979edf969f99a6f59b363ffe9a2cb9b9c24f8d29b720ba35a",
"input": {
"beam_size": "5",
"ce_loss_scale": "0.2",
"cond_text": "Image of a",
"end_factor": "1.01",
"image": "https://replicate.delivery/mgxm/0958ab0c-8d26-45f8-a5f1-a27a1f2259cc/baby.jpg",
"max_seq_length": "15"
},
"logs": "08/12/2021 13:20:37 | [' baby %% -1.9783461', ' newborn %% -2.632012', ' child %% -3.1142285', ' Baby %% -3.6589427', ' infant %% -3.8890254']\n/root/.pyenv/versions/3.8.12/lib/python3.8/site-packages/torch/_tensor.py:575: UserWarning: floor_divide is deprecated, and will be removed in a future version of pytorch. It currently rounds toward 0 (like the 'trunc' function NOT 'floor'). This results in incorrect rounding for negative values.\n08/12/2021 13:20:49 | [' baby in %% -3.415359', ' baby sleeping %% -3.425561', ' newborn photo %% -3.4403224', ' baby on %% -3.5201316', ' baby. %% -3.6261525']\nTo keep the current behavior, use torch.div(a, b, rounding_mode='trunc'), or for actual floor division, use torch.div(a, b, rounding_mode='floor'). (Triggered internally at /pytorch/aten/src/ATen/native/BinaryOps.cpp:467.)\n return torch.floor_divide(self, other)\n08/12/2021 13:21:01 | [' baby on leaves %% -3.4305604', ' baby in the %% -3.6233037', ' baby.! %% -3.6261525', ' baby on grass %% -3.6841075', ' baby sleeping in %% -3.69094']\n08/12/2021 13:21:13 | [' baby.!! %% -3.6261525', ' baby on leaves. %% -3.6822686', ' baby sleeping in a %% -3.8298764', ' baby sleeping in green %% -3.830517', ' baby on grass. %% -3.8318949']\n08/12/2021 13:21:26 | [' baby.!!! %% -3.6261525', ' baby on leaves.! %% -3.6822686', ' baby on grass.! %% -3.8318949', ' baby sleeping in a flower %% -3.8424401', ' baby sleeping in a green %% -3.9262307']\n08/12/2021 13:21:39 | [' baby.!!!! %% -3.6261525', ' baby on leaves.!! %% -3.6822686', ' baby on grass.!! %% -3.8318949', ' baby sleeping in a flower. %% -3.890606', ' baby sleeping in a green flower %% -4.0138764']\n08/12/2021 13:21:51 | [' baby.!!!!! %% -3.6261525', ' baby on leaves.!!! %% -3.6822686', ' baby on grass.!!! %% -3.8318949', ' baby sleeping in a flower.! %% -3.890606', ' baby sleeping in a green flower. %% -4.1707625']",
"output": [
{
"text": "Best CLIP: Image of a baby sleeping in a green flower. \nBest fluency: Image of a baby sleeping in a green flower. \nBest mixed: Image of a baby."
}
],
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2021-12-08T13:17:37.003837Z",
"started_at": "2021-12-08T13:20:35.151031Z",
"completed_at": "2021-12-08T13:21:53.131201Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/mhjecpjikfbfhnpypayu32dhc4/cancel",
"get": "https://api.replicate.com/v1/predictions/mhjecpjikfbfhnpypayu32dhc4"
},
"metrics": {
"predict_time": 77.98017,
"total_time": 256.127364
}
}