Failed to load versions. Head to the versions page to see all versions for this model.
You're looking at a specific version of this model. Jump to the model overview.
hongchaodeng /cog-cog-stable-diffusion:ad59a447
Input
Run this model in Node.js with one line of code:
npm install replicate
REPLICATE_API_TOKEN
environment variable:export REPLICATE_API_TOKEN=<paste-your-token-here>
Find your API token in your account settings.
import Replicate from "replicate";
import fs from "node:fs";
const replicate = new Replicate({
auth: process.env.REPLICATE_API_TOKEN,
});
Run hongchaodeng/cog-cog-stable-diffusion using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"hongchaodeng/cog-cog-stable-diffusion:ad59a4472eb2f99b3d3a7352a1b375625ed5a50ab8c8f4361842a502c8af0f54",
{
input: {
width: 128,
height: 128,
prompt: "a photo of an astronaut riding a horse on mars",
scheduler: "DPMSolverMultistep",
num_outputs: 1,
guidance_scale: 7.5,
num_inference_steps: 8
}
}
);
// To access the file URL:
console.log(output[0].url()); //=> "http://example.com"
// To write the file to disk:
fs.writeFile("my-image.png", output[0]);
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=<paste-your-token-here>
Find your API token in your account settings.
import replicate
Run hongchaodeng/cog-cog-stable-diffusion using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"hongchaodeng/cog-cog-stable-diffusion:ad59a4472eb2f99b3d3a7352a1b375625ed5a50ab8c8f4361842a502c8af0f54",
input={
"width": 128,
"height": 128,
"prompt": "a photo of an astronaut riding a horse on mars",
"scheduler": "DPMSolverMultistep",
"num_outputs": 1,
"guidance_scale": 7.5,
"num_inference_steps": 8
}
)
print(output)
To learn more, take a look at the guide on getting started with Python.
REPLICATE_API_TOKEN
environment variable:export REPLICATE_API_TOKEN=<paste-your-token-here>
Find your API token in your account settings.
Run hongchaodeng/cog-cog-stable-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": "hongchaodeng/cog-cog-stable-diffusion:ad59a4472eb2f99b3d3a7352a1b375625ed5a50ab8c8f4361842a502c8af0f54",
"input": {
"width": 128,
"height": 128,
"prompt": "a photo of an astronaut riding a horse on mars",
"scheduler": "DPMSolverMultistep",
"num_outputs": 1,
"guidance_scale": 7.5,
"num_inference_steps": 8
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
Add a payment method to run this model.
By signing in, you agree to our
terms of service and privacy policy
Output
{
"completed_at": "2023-05-25T06:35:31.545052Z",
"created_at": "2023-05-25T06:35:30.120056Z",
"data_removed": false,
"error": null,
"id": "vc6taklf2rgfxahbs5gf7fn2ju",
"input": {
"width": "128",
"height": "128",
"prompt": "a photo of an astronaut riding a horse on mars",
"scheduler": "DPMSolverMultistep",
"num_outputs": 1,
"guidance_scale": 7.5,
"num_inference_steps": 8
},
"logs": "Using seed: 21183\n 0%| | 0/8 [00:00<?, ?it/s]\n 12%|█▎ | 1/8 [00:00<00:00, 7.83it/s]\n 25%|██▌ | 2/8 [00:00<00:01, 4.28it/s]\n 38%|███▊ | 3/8 [00:00<00:00, 5.77it/s]\n 50%|█████ | 4/8 [00:00<00:00, 6.85it/s]\n 62%|██████▎ | 5/8 [00:00<00:00, 7.62it/s]\n 75%|███████▌ | 6/8 [00:00<00:00, 8.28it/s]\n 88%|████████▊ | 7/8 [00:00<00:00, 8.72it/s]\n100%|██████████| 8/8 [00:01<00:00, 8.96it/s]\n100%|██████████| 8/8 [00:01<00:00, 7.58it/s]",
"metrics": {
"predict_time": 1.451225,
"total_time": 1.424996
},
"output": [
"https://replicate.delivery/pbxt/rI8JTZ1sMTJ4B94p0XWIKwRTB8lhBa1GZ3lPy4qdANwszyPE/out-0.png"
],
"started_at": "2023-05-25T06:35:30.093827Z",
"status": "succeeded",
"urls": {
"get": "https://api.replicate.com/v1/predictions/vc6taklf2rgfxahbs5gf7fn2ju",
"cancel": "https://api.replicate.com/v1/predictions/vc6taklf2rgfxahbs5gf7fn2ju/cancel"
},
"version": "ad59a4472eb2f99b3d3a7352a1b375625ed5a50ab8c8f4361842a502c8af0f54"
}
Using seed: 21183
0%| | 0/8 [00:00<?, ?it/s]
12%|█▎ | 1/8 [00:00<00:00, 7.83it/s]
25%|██▌ | 2/8 [00:00<00:01, 4.28it/s]
38%|███▊ | 3/8 [00:00<00:00, 5.77it/s]
50%|█████ | 4/8 [00:00<00:00, 6.85it/s]
62%|██████▎ | 5/8 [00:00<00:00, 7.62it/s]
75%|███████▌ | 6/8 [00:00<00:00, 8.28it/s]
88%|████████▊ | 7/8 [00:00<00:00, 8.72it/s]
100%|██████████| 8/8 [00:01<00:00, 8.96it/s]
100%|██████████| 8/8 [00:01<00:00, 7.58it/s]