Table of contents
With Replicate, you can run InstantID in the cloud with one line of code.
You can run InstantID with our official JavaScript client:
npm install replicate
Set the REPLICATE_API_TOKEN
environment variable:
export REPLICATE_API_TOKEN=<your-api-token>
Import and set up the client:
import Replicate from "replicate";
const replicate = new Replicate({
auth: process.env.REPLICATE_API_TOKEN,
});
Run zsxkib/instant-id using Replicate’s API:
const output = await replicate.run(
"zsxkib/instant-id:latest",
{
input: {
"image": "https://replicate.delivery/pbxt/KIIutO7jIleskKaWebhvurgBUlHR6M6KN7KHaMMWSt4OnVrF/musk_resize.jpeg",
"width": 640,
"height": 640,
"prompt": "analog film photo of a man. faded film, desaturated, 35mm photo, grainy, vignette, vintage, Kodachrome, Lomography, stained, highly detailed, found footage, masterpiece, best quality",
"sdxl_weights": "protovision-xl-high-fidel",
"guidance_scale": 5,
"negative_prompt": "(lowres, low quality, worst quality:1.2), (text:1.2), watermark, painting, drawing, illustration, glitch, deformed, mutated, cross-eyed, ugly, disfigured (lowres, low quality, worst quality:1.2), (text:1.2), watermark, painting, drawing, illustration, glitch,deformed, mutated, cross-eyed, ugly, disfigured",
"ip_adapter_scale": 0.8,
"num_inference_steps": 30,
"disable_safety_checker": False,
"controlnet_conditioning_scale": 0.8
}
}
);
console.log(output);
Note that InstandID takes an image as input. You can provide URLs or base 64 strings as values for the image.
To learn more, take a look at the guide on getting started with Node.js.
You can run InstantID with our official Python client:
pip install replicate
Set the REPLICATE_API_TOKEN
environment variable:
export REPLICATE_API_TOKEN=<your-api-token>
Run zsxkib/instant-id using Replicate’s API:
import replicate
output = replicate.run(
"zsxkib/instant-id:latest",
input={
"image": "https://replicate.delivery/pbxt/KIIutO7jIleskKaWebhvurgBUlHR6M6KN7KHaMMWSt4OnVrF/musk_resize.jpeg",
"width": 640,
"height": 640,
"prompt": "analog film photo of a man. faded film, desaturated, 35mm photo, grainy, vignette, vintage, Kodachrome, Lomography, stained, highly detailed, found footage, masterpiece, best quality",
"sdxl_weights": "protovision-xl-high-fidel",
"guidance_scale": 5,
"negative_prompt": "(lowres, low quality, worst quality:1.2), (text:1.2), watermark, painting, drawing, illustration, glitch, deformed, mutated, cross-eyed, ugly, disfigured (lowres, low quality, worst quality:1.2), (text:1.2), watermark, painting, drawing, illustration, glitch,deformed, mutated, cross-eyed, ugly, disfigured",
"ip_adapter_scale": 0.8,
"num_inference_steps": 30,
"disable_safety_checker": False,
"controlnet_conditioning_scale": 0.8
}
)
print(output)
Note that InstandID takes an image as input. You can provide URLs or base 64 strings as values for the image.
To learn more, take a look at the guide on getting started with Python.
You can call the HTTP API directly with tools like cURL:
Set the REPLICATE_API_TOKEN
environment variable:
export REPLICATE_API_TOKEN=<your-api-token>
Run zsxkib/instant-id using Replicate’s API:
curl -s -X POST \
-H "Authorization: Token $REPLICATE_API_TOKEN" \
-H "Content-Type: application/json" \
-d $'{
"version": "c98b2e7a196828d00955767813b81fc05c5c9b294c670c6d147d545fed4ceecf",
"input": {
"image": "https://replicate.delivery/pbxt/KIIutO7jIleskKaWebhvurgBUlHR6M6KN7KHaMMWSt4OnVrF/musk_resize.jpeg",
"width": 640,
"height": 640,
"prompt": "analog film photo of a man. faded film, desaturated, 35mm photo, grainy, vignette, vintage, Kodachrome, Lomography, stained, highly detailed, found footage, masterpiece, best quality",
"sdxl_weights": "protovision-xl-high-fidel",
"guidance_scale": 5,
"negative_prompt": "(lowres, low quality, worst quality:1.2), (text:1.2), watermark, painting, drawing, illustration, glitch, deformed, mutated, cross-eyed, ugly, disfigured (lowres, low quality, worst quality:1.2), (text:1.2), watermark, painting, drawing, illustration, glitch,deformed, mutated, cross-eyed, ugly, disfigured",
"ip_adapter_scale": 0.8,
"num_inference_steps": 30,
"disable_safety_checker": False,
"controlnet_conditioning_scale": 0.8
}
}' \
https://api.replicate.com/v1/models/zsxkib/instant-id/predictions
Note that InstandID takes an image as input. You can provide URLs or base 64 strings as values for the image.
To learn more, take a look at Replicate’s HTTP API reference docs.
You can also run InstantID using other Replicate client libraries for Golang, Swift, Elixir, and others