typetext
{
"batch_size": 1,
"controlnet_conditioning_scale": 1.5,
"guidance_scale": 7.5,
"negative_prompt": "ugly, disfigured, low quality, blurry, nsfw",
"num_inference_steps": 40,
"prompt": "The french countryside, green pastures, lush environment, vivid colors, animation by studio ghibli",
"qr_code_content": "https://replicate.com",
"seed": 1234,
"strength": 0.9
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_FOw**********************************
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 nateraw/qrcode-stable-diffusion using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"nateraw/qrcode-stable-diffusion:9cdabf8f8a991351960c7ce2105de2909514b40bd27ac202dba57935b07d29d4",
{
input: {
batch_size: 1,
controlnet_conditioning_scale: 1.5,
guidance_scale: 7.5,
negative_prompt: "ugly, disfigured, low quality, blurry, nsfw",
num_inference_steps: 40,
prompt: "The french countryside, green pastures, lush environment, vivid colors, animation by studio ghibli",
qr_code_content: "https://replicate.com",
seed: 1234,
strength: 0.9
}
}
);
// 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=r8_FOw**********************************
This is your API token. Keep it to yourself.
import replicate
Run nateraw/qrcode-stable-diffusion using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"nateraw/qrcode-stable-diffusion:9cdabf8f8a991351960c7ce2105de2909514b40bd27ac202dba57935b07d29d4",
input={
"batch_size": 1,
"controlnet_conditioning_scale": 1.5,
"guidance_scale": 7.5,
"negative_prompt": "ugly, disfigured, low quality, blurry, nsfw",
"num_inference_steps": 40,
"prompt": "The french countryside, green pastures, lush environment, vivid colors, animation by studio ghibli",
"qr_code_content": "https://replicate.com",
"seed": 1234,
"strength": 0.9
}
)
# To access the file URL:
print(output[0].url())
#=> "http://example.com"
# To write the file to disk:
with open("my-image.png", "wb") as file:
file.write(output[0].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_FOw**********************************
This is your API token. Keep it to yourself.
Run nateraw/qrcode-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": "nateraw/qrcode-stable-diffusion:9cdabf8f8a991351960c7ce2105de2909514b40bd27ac202dba57935b07d29d4",
"input": {
"batch_size": 1,
"controlnet_conditioning_scale": 1.5,
"guidance_scale": 7.5,
"negative_prompt": "ugly, disfigured, low quality, blurry, nsfw",
"num_inference_steps": 40,
"prompt": "The french countryside, green pastures, lush environment, vivid colors, animation by studio ghibli",
"qr_code_content": "https://replicate.com",
"seed": 1234,
"strength": 0.9
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "vzurxizbjue7tk54vkxnlzvzta",
"model": "nateraw/qrcode-stable-diffusion",
"version": "9cdabf8f8a991351960c7ce2105de2909514b40bd27ac202dba57935b07d29d4",
"input": {
"batch_size": 1,
"controlnet_conditioning_scale": 1.5,
"guidance_scale": 7.5,
"negative_prompt": "ugly, disfigured, low quality, blurry, nsfw",
"num_inference_steps": 40,
"prompt": "The french countryside, green pastures, lush environment, vivid colors, animation by studio ghibli",
"qr_code_content": "https://replicate.com",
"seed": 1234,
"strength": 0.9
},
"logs": "Generating QR Code from content\n 0%| | 0/36 [00:00<?, ?it/s]\n 3%|▎ | 1/36 [00:00<00:21, 1.61it/s]\n 6%|▌ | 2/36 [00:01<00:18, 1.81it/s]\n 8%|▊ | 3/36 [00:01<00:17, 1.89it/s]\n 11%|█ | 4/36 [00:02<00:16, 1.92it/s]\n 14%|█▍ | 5/36 [00:02<00:16, 1.94it/s]\n 17%|█▋ | 6/36 [00:03<00:15, 1.95it/s]\n 19%|█▉ | 7/36 [00:03<00:14, 1.95it/s]\n 22%|██▏ | 8/36 [00:04<00:14, 1.96it/s]\n 25%|██▌ | 9/36 [00:04<00:13, 1.96it/s]\n 28%|██▊ | 10/36 [00:05<00:13, 1.97it/s]\n 31%|███ | 11/36 [00:05<00:12, 1.97it/s]\n 33%|███▎ | 12/36 [00:06<00:12, 1.96it/s]\n 36%|███▌ | 13/36 [00:06<00:11, 1.96it/s]\n 39%|███▉ | 14/36 [00:07<00:11, 1.95it/s]\n 42%|████▏ | 15/36 [00:07<00:10, 1.95it/s]\n 44%|████▍ | 16/36 [00:08<00:10, 1.95it/s]\n 47%|████▋ | 17/36 [00:08<00:09, 1.95it/s]\n 50%|█████ | 18/36 [00:09<00:09, 1.95it/s]\n 53%|█████▎ | 19/36 [00:09<00:08, 1.95it/s]\n 56%|█████▌ | 20/36 [00:10<00:08, 1.94it/s]\n 58%|█████▊ | 21/36 [00:10<00:07, 1.94it/s]\n 61%|██████ | 22/36 [00:11<00:07, 1.94it/s]\n 64%|██████▍ | 23/36 [00:11<00:06, 1.94it/s]\n 67%|██████▋ | 24/36 [00:12<00:06, 1.94it/s]\n 69%|██████▉ | 25/36 [00:12<00:05, 1.94it/s]\n 72%|███████▏ | 26/36 [00:13<00:05, 1.94it/s]\n 75%|███████▌ | 27/36 [00:13<00:04, 1.94it/s]\n 78%|███████▊ | 28/36 [00:14<00:04, 1.93it/s]\n 81%|████████ | 29/36 [00:14<00:03, 1.94it/s]\n 83%|████████▎ | 30/36 [00:15<00:03, 1.93it/s]\n 86%|████████▌ | 31/36 [00:15<00:02, 1.93it/s]\n 89%|████████▉ | 32/36 [00:16<00:02, 1.93it/s]\n 92%|█████████▏| 33/36 [00:17<00:01, 1.93it/s]\n 94%|█████████▍| 34/36 [00:17<00:01, 1.93it/s]\n 97%|█████████▋| 35/36 [00:18<00:00, 1.93it/s]\n100%|██████████| 36/36 [00:18<00:00, 1.92it/s]\n100%|██████████| 36/36 [00:18<00:00, 1.94it/s]",
"output": [
"https://replicate.delivery/pbxt/ELT1NcUX34Y9JRTgMBAC0fdsVJG0j5flt6ksOaouz8YcJfViA/output-0.png"
],
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2023-06-30T02:32:43.529254Z",
"started_at": "2023-06-30T02:38:57.820587Z",
"completed_at": "2023-06-30T02:39:25.006348Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/vzurxizbjue7tk54vkxnlzvzta/cancel",
"get": "https://api.replicate.com/v1/predictions/vzurxizbjue7tk54vkxnlzvzta"
},
"metrics": {
"predict_time": 27.185761,
"total_time": 401.477094
}
}