typefile
{
"beam_size": "5",
"ce_loss_scale": 0.2,
"cond_text": "Image of",
"end_factors": 1.06,
"image1": "https://replicate.delivery/mgxm/df567013-7696-4a58-89ae-e72fcd539929/pyramid.jpg",
"image2": "https://replicate.delivery/mgxm/9e0c882e-3c1a-40b6-b231-d032a10b5ebd/usa.jpg",
"image3": "https://replicate.delivery/mgxm/2c259b12-8940-4502-8206-9af24e663ee2/capitol.jpg",
"max_seq_lengths": "4"
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_LDC**********************************
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/arithmetic using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"yoadtew/arithmetic:737d4915f4d8303b5f38cd3ecbbc310bda34b76044473de002f1e23494d86218",
{
input: {
beam_size: "5",
ce_loss_scale: 0.2,
cond_text: "Image of",
end_factors: 1.06,
image1: "https://replicate.delivery/mgxm/df567013-7696-4a58-89ae-e72fcd539929/pyramid.jpg",
image2: "https://replicate.delivery/mgxm/9e0c882e-3c1a-40b6-b231-d032a10b5ebd/usa.jpg",
image3: "https://replicate.delivery/mgxm/2c259b12-8940-4502-8206-9af24e663ee2/capitol.jpg",
max_seq_lengths: "4"
}
}
);
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_LDC**********************************
This is your API token. Keep it to yourself.
import replicate
Run yoadtew/arithmetic using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"yoadtew/arithmetic:737d4915f4d8303b5f38cd3ecbbc310bda34b76044473de002f1e23494d86218",
input={
"beam_size": "5",
"ce_loss_scale": 0.2,
"cond_text": "Image of",
"end_factors": 1.06,
"image1": "https://replicate.delivery/mgxm/df567013-7696-4a58-89ae-e72fcd539929/pyramid.jpg",
"image2": "https://replicate.delivery/mgxm/9e0c882e-3c1a-40b6-b231-d032a10b5ebd/usa.jpg",
"image3": "https://replicate.delivery/mgxm/2c259b12-8940-4502-8206-9af24e663ee2/capitol.jpg",
"max_seq_lengths": "4"
}
)
# The yoadtew/arithmetic 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/arithmetic/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_LDC**********************************
This is your API token. Keep it to yourself.
Run yoadtew/arithmetic 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/arithmetic:737d4915f4d8303b5f38cd3ecbbc310bda34b76044473de002f1e23494d86218",
"input": {
"beam_size": "5",
"ce_loss_scale": 0.2,
"cond_text": "Image of",
"end_factors": 1.06,
"image1": "https://replicate.delivery/mgxm/df567013-7696-4a58-89ae-e72fcd539929/pyramid.jpg",
"image2": "https://replicate.delivery/mgxm/9e0c882e-3c1a-40b6-b231-d032a10b5ebd/usa.jpg",
"image3": "https://replicate.delivery/mgxm/2c259b12-8940-4502-8206-9af24e663ee2/capitol.jpg",
"max_seq_lengths": "4"
}
}' \
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 Egypt. \nBest fluency: Image of U. \nBest mixed: Image of U.",
"typeMismatch": false
}
},
"inferred": false,
"outputValue": {
"text": "Best CLIP: Image of Egypt. \nBest fluency: Image of U. \nBest mixed: Image of U."
},
"typeMismatch": false
}{
"id": "laibiaimzjhi5i7lmn65upoh4i",
"model": "yoadtew/arithmetic",
"version": "737d4915f4d8303b5f38cd3ecbbc310bda34b76044473de002f1e23494d86218",
"input": {
"beam_size": "5",
"ce_loss_scale": 0.2,
"cond_text": "Image of",
"end_factors": 1.06,
"image1": "https://replicate.delivery/mgxm/df567013-7696-4a58-89ae-e72fcd539929/pyramid.jpg",
"image2": "https://replicate.delivery/mgxm/9e0c882e-3c1a-40b6-b231-d032a10b5ebd/usa.jpg",
"image3": "https://replicate.delivery/mgxm/2c259b12-8940-4502-8206-9af24e663ee2/capitol.jpg",
"max_seq_lengths": "4"
},
"logs": "07/02/2022 20:43:19 | [' the %% -3.7102294', ' Egyptian %% -3.7111435', ' US %% -3.716634', ' U %% -4.0127826', ' Egypt %% -4.1653075']\n07/02/2022 20:43:31 | [' U. %% -2.9583662', ' Egypt. %% -3.1702278', ' US. %% -3.7043114', ' the US %% -4.009556', ' Egyptian. %% -4.1966124']\n07/02/2022 20:43:42 | [' U.! %% -2.9583662', ' Egypt.! %% -3.1702278', ' the US. %% -3.350386', ' US.! %% -3.7043114', ' Egyptian.! %% -4.1966124']",
"output": [
{
"text": "Best CLIP: Image of Egypt. \nBest fluency: Image of U. \nBest mixed: Image of U."
}
],
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2022-02-07T20:43:16.11228Z",
"started_at": "2022-02-07T20:43:16.360652Z",
"completed_at": "2022-02-07T20:43:43.331515Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/laibiaimzjhi5i7lmn65upoh4i/cancel",
"get": "https://api.replicate.com/v1/predictions/laibiaimzjhi5i7lmn65upoh4i"
},
"metrics": {
"predict_time": 26.970863,
"total_time": 27.219235
}
}

