typefile
{
"height": 1024,
"model": "fast",
"negative_prompt": "",
"number_of_images": 1,
"output_format": "webp",
"output_quality": 80,
"prompt": "An astronaut riding a unicorn",
"structure_denoising_strength": 0.65,
"structure_depth_strength": 1,
"style_image": "https://replicate.delivery/pbxt/KlTqluRakBzt7N5mm1WExEQCc4J3usa7E3n5dhttcayTqFRm/van-gogh.jpeg",
"width": 1024
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_3NY**********************************
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 fofr/style-transfer using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"fofr/style-transfer:f1023890703bc0a5a3a2c21b5e498833be5f6ef6e70e9daf6b9b3a4fd8309cf0",
{
input: {
height: 1024,
model: "fast",
negative_prompt: "",
number_of_images: 1,
output_format: "webp",
output_quality: 80,
prompt: "An astronaut riding a unicorn",
structure_denoising_strength: 0.65,
structure_depth_strength: 1,
style_image: "https://replicate.delivery/pbxt/KlTqluRakBzt7N5mm1WExEQCc4J3usa7E3n5dhttcayTqFRm/van-gogh.jpeg",
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_3NY**********************************
This is your API token. Keep it to yourself.
import replicate
Run fofr/style-transfer using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"fofr/style-transfer:f1023890703bc0a5a3a2c21b5e498833be5f6ef6e70e9daf6b9b3a4fd8309cf0",
input={
"height": 1024,
"model": "fast",
"negative_prompt": "",
"number_of_images": 1,
"output_format": "webp",
"output_quality": 80,
"prompt": "An astronaut riding a unicorn",
"structure_denoising_strength": 0.65,
"structure_depth_strength": 1,
"style_image": "https://replicate.delivery/pbxt/KlTqluRakBzt7N5mm1WExEQCc4J3usa7E3n5dhttcayTqFRm/van-gogh.jpeg",
"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_3NY**********************************
This is your API token. Keep it to yourself.
Run fofr/style-transfer 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": "fofr/style-transfer:f1023890703bc0a5a3a2c21b5e498833be5f6ef6e70e9daf6b9b3a4fd8309cf0",
"input": {
"height": 1024,
"model": "fast",
"negative_prompt": "",
"number_of_images": 1,
"output_format": "webp",
"output_quality": 80,
"prompt": "An astronaut riding a unicorn",
"structure_denoising_strength": 0.65,
"structure_depth_strength": 1,
"style_image": "https://replicate.delivery/pbxt/KlTqluRakBzt7N5mm1WExEQCc4J3usa7E3n5dhttcayTqFRm/van-gogh.jpeg",
"width": 1024
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "t71z6mcv6hrma0cke9xrtyzm1w",
"model": "fofr/style-transfer",
"version": "f1023890703bc0a5a3a2c21b5e498833be5f6ef6e70e9daf6b9b3a4fd8309cf0",
"input": {
"height": 1024,
"model": "fast",
"negative_prompt": "",
"number_of_images": 1,
"output_format": "webp",
"output_quality": 80,
"prompt": "An astronaut riding a unicorn",
"structure_denoising_strength": 0.65,
"structure_depth_strength": 1,
"style_image": "https://replicate.delivery/pbxt/KlTqluRakBzt7N5mm1WExEQCc4J3usa7E3n5dhttcayTqFRm/van-gogh.jpeg",
"width": 1024
},
"logs": "Random seed set to: 1640868803\nChecking weights\nIncluding weights for IPAdapter preset: PLUS (high strength)\n✅ ip-adapter-plus_sdxl_vit-h.safetensors\n✅ CLIP-ViT-H-14-laion2B-s32B-b79K.safetensors\n✅ dreamshaperXL_lightningDPMSDE.safetensors\n====================================\nRunning workflow\ngot prompt\nExecuting node 2, title: Load Checkpoint, class type: CheckpointLoaderSimple\nmodel_type EPS\nUsing pytorch attention in VAE\nUsing pytorch attention in VAE\nclip missing: ['clip_l.logit_scale', 'clip_l.transformer.text_projection.weight']\nloaded straight to GPU\nRequested to load SDXL\nLoading 1 new model\nExecuting node 1, title: IPAdapter Unified Loader, class type: IPAdapterUnifiedLoader\n\u001b[33mINFO: Clip Vision model loaded from /src/ComfyUI/models/clip_vision/CLIP-ViT-H-14-laion2B-s32B-b79K.safetensors\u001b[0m\n\u001b[33mINFO: IPAdapter model loaded from /src/ComfyUI/models/ipadapter/ip-adapter-plus_sdxl_vit-h.safetensors\u001b[0m\nExecuting node 5, title: Load Image, class type: LoadImage\n\u001b[33mINFO: the IPAdapter reference image is not a square, CLIPImageProcessor will resize and crop it at the center. If the main focus of the picture is not in the middle the result might not be what you are expecting.\u001b[0m\nExecuting node 4, title: IPAdapter, class type: IPAdapter\nRequested to load CLIPVisionModelProjection\nLoading 1 new model\nExecuting node 6, title: CLIP Text Encode (Prompt), class type: CLIPTextEncode\nRequested to load SDXLClipModel\nLoading 1 new model\nExecuting node 7, title: CLIP Text Encode (Prompt), class type: CLIPTextEncode\nExecuting node 10, title: Empty Latent Image, class type: EmptyLatentImage\nExecuting node 3, title: KSampler, class type: KSampler\nRequested to load SDXL\nLoading 1 new model\n 0%| | 0/4 [00:00<?, ?it/s]/root/.pyenv/versions/3.10.6/lib/python3.10/site-packages/torchsde/_brownian/brownian_interval.py:608: UserWarning: Should have tb<=t1 but got tb=14.614644050598145 and t1=14.614643.\nwarnings.warn(f\"Should have {tb_name}<=t1 but got {tb_name}={tb} and t1={self._end}.\")\n 25%|██▌ | 1/4 [00:00<00:01, 2.99it/s]\n 50%|█████ | 2/4 [00:00<00:00, 3.64it/s]\n 75%|███████▌ | 3/4 [00:00<00:00, 3.94it/s]\n100%|██████████| 4/4 [00:00<00:00, 5.05it/s]\n100%|██████████| 4/4 [00:00<00:00, 4.40it/s]\nRequested to load AutoencoderKL\nLoading 1 new model\nExecuting node 8, title: VAE Decode, class type: VAEDecode\nExecuting node 9, title: Save Image, class type: SaveImage\nPrompt executed in 5.15 seconds\noutputs: {'9': {'images': [{'filename': 'ComfyUI_00001_.png', 'subfolder': '', 'type': 'output'}]}}\n====================================\nComfyUI_00001_.png",
"output": [
"https://replicate.delivery/xezq/OgPfUK3cTWSYF6ZKr30ItkZClxuuf3INMygNv48O47wRLg1TA/ComfyUI_00001_.webp"
],
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2024-11-28T11:15:23.572Z",
"started_at": "2024-11-28T11:15:23.583714Z",
"completed_at": "2024-11-28T11:15:29.481256Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/t71z6mcv6hrma0cke9xrtyzm1w/cancel",
"get": "https://api.replicate.com/v1/predictions/t71z6mcv6hrma0cke9xrtyzm1w",
"stream": "https://stream.replicate.com/v1/files/bcwr-ylw2cq4qmhgzi5wukon7sd7n2euktdfpoled6mp6tqvfknt5xnqq",
"web": "https://replicate.com/p/t71z6mcv6hrma0cke9xrtyzm1w"
},
"metrics": {
"predict_time": 5.8975421279999996,
"total_time": 5.909256
}
}
