typetext
{
"display_frequency": "30",
"iterations": "300",
"prompt": "portrait painting of neon gods by Into the Void"
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_7v0**********************************
This is your API token. Keep it to yourself.
import Replicate from "replicate";
const replicate = new Replicate({
auth: process.env.REPLICATE_API_TOKEN,
});
Run ekgren/structureddreaming using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"ekgren/structureddreaming:b6a248320b3a985ea4c9f0709ad1843b0ac3a320863a79d546bb9809ec6c4df4",
{
input: {
display_frequency: "30",
iterations: "300",
prompt: "portrait painting of neon gods by Into the Void"
}
}
);
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_7v0**********************************
This is your API token. Keep it to yourself.
import replicate
Run ekgren/structureddreaming using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"ekgren/structureddreaming:b6a248320b3a985ea4c9f0709ad1843b0ac3a320863a79d546bb9809ec6c4df4",
input={
"display_frequency": "30",
"iterations": "300",
"prompt": "portrait painting of neon gods by Into the Void"
}
)
# The ekgren/structureddreaming 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/ekgren/structureddreaming/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_7v0**********************************
This is your API token. Keep it to yourself.
Run ekgren/structureddreaming 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": "ekgren/structureddreaming:b6a248320b3a985ea4c9f0709ad1843b0ac3a320863a79d546bb9809ec6c4df4",
"input": {
"display_frequency": "30",
"iterations": "300",
"prompt": "portrait painting of neon gods by Into the Void"
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"outputType": "object",
"properties": {
"file": {
"outputType": "uri",
"mimeType": "image/png",
"inferred": false,
"outputValue": "https://replicate.delivery/mgxm/12a407bb-0374-4f8a-9141-6dedd2c2eb59/out.png",
"typeMismatch": false
}
},
"inferred": false,
"outputValue": {
"file": "https://replicate.delivery/mgxm/12a407bb-0374-4f8a-9141-6dedd2c2eb59/out.png"
},
"typeMismatch": false
}{
"id": "s4s6brg2tffqxlaowbqqreuju4",
"model": "ekgren/structureddreaming",
"version": "b6a248320b3a985ea4c9f0709ad1843b0ac3a320863a79d546bb9809ec6c4df4",
"input": {
"display_frequency": "30",
"iterations": "300",
"prompt": "portrait painting of neon gods by Into the Void"
},
"logs": "Generating image.\nSetting up PyTorch plugin \"bias_act_plugin\"...\nDone.\nSetting up PyTorch plugin \"upfirdn2d_plugin\"...\nDone.\nstep: 30, loss: -20.546875, img.min: -0.04773811250925064, img.max: 0.9971683621406555\nstep: 60, loss: -25.734375, img.min: -0.049006085842847824, img.max: 1.026373267173767\nstep: 90, loss: -26.46875, img.min: -0.07080622762441635, img.max: 1.0104471445083618\nstep: 120, loss: -34.125, img.min: -0.0940389633178711, img.max: 1.0469348430633545\nstep: 150, loss: -31.5, img.min: -0.1317528337240219, img.max: 1.000837802886963\nstep: 180, loss: -35.15625, img.min: -0.11546284705400467, img.max: 1.0702193975448608\nstep: 210, loss: -34.46875, img.min: -0.05544739216566086, img.max: 0.9569833278656006\nstep: 240, loss: -30.828125, img.min: -0.09335537254810333, img.max: 0.9662722945213318\nstep: 270, loss: -38.53125, img.min: -0.07021424919366837, img.max: 0.9920296669006348",
"output": [
{
"file": "https://replicate.delivery/mgxm/b498e10e-c1d8-4f1e-bcd5-6c4bf4b29bc7/out.png"
},
{
"file": "https://replicate.delivery/mgxm/37b92194-1742-45c9-abe7-109fd094335d/out.png"
},
{
"file": "https://replicate.delivery/mgxm/8b0c81ed-b418-4b1a-8d89-4f4650b76574/out.png"
},
{
"file": "https://replicate.delivery/mgxm/c4ad6c52-736b-43e8-a3c8-76c4e08fef09/out.png"
},
{
"file": "https://replicate.delivery/mgxm/b0bf6d75-dee5-4b1f-aa30-140977d18baf/out.png"
},
{
"file": "https://replicate.delivery/mgxm/cd1cb97a-480c-48df-b750-6c8f0ae07c30/out.png"
},
{
"file": "https://replicate.delivery/mgxm/e9c79f9d-5def-4778-9057-c54883ee1b8d/out.png"
},
{
"file": "https://replicate.delivery/mgxm/261943fe-25be-4c4b-8eb8-d1f3f893e2d7/out.png"
},
{
"file": "https://replicate.delivery/mgxm/12a407bb-0374-4f8a-9141-6dedd2c2eb59/out.png"
}
],
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2021-10-05T21:37:18.21303Z",
"started_at": "2022-06-16T08:39:22.50461Z",
"completed_at": "2021-10-05T21:41:00.795314Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/s4s6brg2tffqxlaowbqqreuju4/cancel",
"get": "https://api.replicate.com/v1/predictions/s4s6brg2tffqxlaowbqqreuju4"
},
"metrics": {
"total_time": 222.582284
}
}