defaulta cat wearing sunglasses
typetext
{
"num_inference_steps": 50,
"prompt": "a cat wearing sunglasses"
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_SBQ**********************************
This is your API token. Keep it to yourself.
import Replicate from "replicate";
import fs from "node:fs";
const replicate = new Replicate({
auth: process.env.REPLICATE_API_TOKEN,
});
Run cjwbw/faster-diffusion using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"cjwbw/faster-diffusion:e2d69e0cad30f698ee23c89508006d605cab68ca0673f52ad311cc8caee573e5",
{
input: {
num_inference_steps: 50,
prompt: "a cat wearing sunglasses"
}
}
);
// To access the file URL:
console.log(output.url()); //=> "http://example.com"
// To write the file to disk:
fs.writeFile("my-image.png", 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_SBQ**********************************
This is your API token. Keep it to yourself.
import replicate
Run cjwbw/faster-diffusion using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"cjwbw/faster-diffusion:e2d69e0cad30f698ee23c89508006d605cab68ca0673f52ad311cc8caee573e5",
input={
"num_inference_steps": 50,
"prompt": "a cat wearing sunglasses"
}
)
# To access the file URL:
print(output.url())
#=> "http://example.com"
# To write the file to disk:
with open("my-image.png", "wb") as file:
file.write(output.read())
To learn more, take a look at the guide on getting started with Python.
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_SBQ**********************************
This is your API token. Keep it to yourself.
Run cjwbw/faster-diffusion 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": "cjwbw/faster-diffusion:e2d69e0cad30f698ee23c89508006d605cab68ca0673f52ad311cc8caee573e5",
"input": {
"num_inference_steps": 50,
"prompt": "a cat wearing sunglasses"
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "3pwdw3tbiil7bqkzvknx22fjrm",
"model": "cjwbw/faster-diffusion",
"version": "e2d69e0cad30f698ee23c89508006d605cab68ca0673f52ad311cc8caee573e5",
"input": {
"num_inference_steps": 50,
"prompt": "a cat wearing sunglasses"
},
"logs": "Using seed: 24004",
"output": "https://replicate.delivery/pbxt/zecbhv4ByEVwB6mCXZNbXSqzMNZBbfXpvnPEJeivnjWOMqLkA/out.png",
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2023-12-25T15:26:07.611262Z",
"started_at": "2023-12-25T15:27:51.559902Z",
"completed_at": "2023-12-25T15:28:07.587132Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/3pwdw3tbiil7bqkzvknx22fjrm/cancel",
"get": "https://api.replicate.com/v1/predictions/3pwdw3tbiil7bqkzvknx22fjrm"
},
"metrics": {
"predict_time": 16.02723,
"total_time": 119.97587
}
}