typefile
{
"source": "https://replicate.delivery/mgxm/61081ee0-dd02-4538-a7d4-08986d44e13b/000000.png",
"style": "https://replicate.delivery/mgxm/1898cc8a-51b0-4627-b3cf-e68fdee307fa/100010.png"
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_0Qu**********************************
This is your API token. Keep it to yourself.
import Replicate from "replicate";
const replicate = new Replicate({
auth: process.env.REPLICATE_API_TOKEN,
});
Run onion-liu/blendgan using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"onion-liu/blendgan:3faa372f50dee40fa706f3206bfd02b1f969edec4da72af42597af601e88880e",
{
input: {
source: "https://replicate.delivery/mgxm/61081ee0-dd02-4538-a7d4-08986d44e13b/000000.png",
style: "https://replicate.delivery/mgxm/1898cc8a-51b0-4627-b3cf-e68fdee307fa/100010.png"
}
}
);
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_0Qu**********************************
This is your API token. Keep it to yourself.
import replicate
Run onion-liu/blendgan using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"onion-liu/blendgan:3faa372f50dee40fa706f3206bfd02b1f969edec4da72af42597af601e88880e",
input={
"source": "https://replicate.delivery/mgxm/61081ee0-dd02-4538-a7d4-08986d44e13b/000000.png",
"style": "https://replicate.delivery/mgxm/1898cc8a-51b0-4627-b3cf-e68fdee307fa/100010.png"
}
)
# The onion-liu/blendgan 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/onion-liu/blendgan/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_0Qu**********************************
This is your API token. Keep it to yourself.
Run onion-liu/blendgan 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": "onion-liu/blendgan:3faa372f50dee40fa706f3206bfd02b1f969edec4da72af42597af601e88880e",
"input": {
"source": "https://replicate.delivery/mgxm/61081ee0-dd02-4538-a7d4-08986d44e13b/000000.png",
"style": "https://replicate.delivery/mgxm/1898cc8a-51b0-4627-b3cf-e68fdee307fa/100010.png"
}
}' \
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/79ccc9ff-82f5-49f6-94b2-d295ce8198d4/out.png",
"typeMismatch": false
}
},
"inferred": false,
"outputValue": {
"file": "https://replicate.delivery/mgxm/79ccc9ff-82f5-49f6-94b2-d295ce8198d4/out.png"
},
"typeMismatch": false
}{
"id": "4mvgjbshqjfftp4rxvtq35srhi",
"model": "onion-liu/blendgan",
"version": "3faa372f50dee40fa706f3206bfd02b1f969edec4da72af42597af601e88880e",
"input": {
"source": "https://replicate.delivery/mgxm/61081ee0-dd02-4538-a7d4-08986d44e13b/000000.png",
"style": "https://replicate.delivery/mgxm/1898cc8a-51b0-4627-b3cf-e68fdee307fa/100010.png"
},
"logs": "",
"output": [
{
"file": "https://replicate.delivery/mgxm/79ccc9ff-82f5-49f6-94b2-d295ce8198d4/out.png"
}
],
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2021-11-20T21:06:08.304216Z",
"started_at": "2021-12-07T07:24:10.624804Z",
"completed_at": "2021-11-20T21:07:30.701748Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/4mvgjbshqjfftp4rxvtq35srhi/cancel",
"get": "https://api.replicate.com/v1/predictions/4mvgjbshqjfftp4rxvtq35srhi"
},
"metrics": {
"total_time": 82.397532
}
}
