defaultA superhero smiling
typetext
{
"guidance_scale": 0,
"height": 1024,
"negative_prompt": "worst quality, low quality",
"num_inference_steps": 4,
"num_outputs": 1,
"prompt": "An energetic young woman in workout clothes, jogging in a lush green park with a determined look on her face, sweat glistening on her forehead",
"scheduler": "K_EULER",
"width": 1024
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_dKZ**********************************
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 bytedance/sdxl-lightning-4step using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"bytedance/sdxl-lightning-4step:5f24084160c9089501c1b3545d9be3c27883ae2239b6f412990e82d4a6210f8f",
{
input: {
guidance_scale: 0,
height: 1024,
negative_prompt: "worst quality, low quality",
num_inference_steps: 4,
num_outputs: 1,
prompt: "An energetic young woman in workout clothes, jogging in a lush green park with a determined look on her face, sweat glistening on her forehead",
scheduler: "K_EULER",
width: 1024
}
}
);
// 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_dKZ**********************************
This is your API token. Keep it to yourself.
import replicate
Run bytedance/sdxl-lightning-4step using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"bytedance/sdxl-lightning-4step:5f24084160c9089501c1b3545d9be3c27883ae2239b6f412990e82d4a6210f8f",
input={
"guidance_scale": 0,
"height": 1024,
"negative_prompt": "worst quality, low quality",
"num_inference_steps": 4,
"num_outputs": 1,
"prompt": "An energetic young woman in workout clothes, jogging in a lush green park with a determined look on her face, sweat glistening on her forehead",
"scheduler": "K_EULER",
"width": 1024
}
)
# 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_dKZ**********************************
This is your API token. Keep it to yourself.
Run bytedance/sdxl-lightning-4step 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": "bytedance/sdxl-lightning-4step:5f24084160c9089501c1b3545d9be3c27883ae2239b6f412990e82d4a6210f8f",
"input": {
"guidance_scale": 0,
"height": 1024,
"negative_prompt": "worst quality, low quality",
"num_inference_steps": 4,
"num_outputs": 1,
"prompt": "An energetic young woman in workout clothes, jogging in a lush green park with a determined look on her face, sweat glistening on her forehead",
"scheduler": "K_EULER",
"width": 1024
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "p1nd0a92s1rj40chd98a67n47m",
"model": "bytedance/sdxl-lightning-4step",
"version": "5f24084160c9089501c1b3545d9be3c27883ae2239b6f412990e82d4a6210f8f",
"input": {
"guidance_scale": 0,
"height": 1024,
"negative_prompt": "worst quality, low quality",
"num_inference_steps": 4,
"num_outputs": 1,
"prompt": "An energetic young woman in workout clothes, jogging in a lush green park with a determined look on her face, sweat glistening on her forehead",
"scheduler": "K_EULER",
"width": 1024
},
"logs": "Using seed: 4279359255\nPrompt: An energetic young woman in workout clothes, jogging in a lush green park with a determined look on her face, sweat glistening on her forehead\n 0%| | 0/4 [00:00<?, ?it/s]\n 50%|█████ | 2/4 [00:00<00:00, 16.04it/s]\n100%|██████████| 4/4 [00:00<00:00, 16.27it/s]\n100%|██████████| 4/4 [00:00<00:00, 16.22it/s]",
"output": [
"https://replicate.delivery/yhqm/BSpdfOnK0P3DZKmvCIvSCvOfc9PsZuSmXOe3Of9QRiEVP2QNB/out-0.png"
],
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2024-08-19T11:05:22.376Z",
"started_at": "2024-08-19T11:05:23.963231Z",
"completed_at": "2024-08-19T11:05:25.352445Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/p1nd0a92s1rj40chd98a67n47m/cancel",
"get": "https://api.replicate.com/v1/predictions/p1nd0a92s1rj40chd98a67n47m",
"web": "https://replicate.com/p/p1nd0a92s1rj40chd98a67n47m"
},
"metrics": {
"predict_time": 1.389214685,
"total_time": 2.976445
}
}