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.
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";
const replicate = new Replicate({
auth: process.env.REPLICATE_API_TOKEN,
});
Run cdingram/face-swap using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"cdingram/face-swap:d1d6ea8c8be89d664a07a457526f7128109dee7030fdac424788d762c71ed111",
{
input: {
swap_image: "https://replicate.delivery/pbxt/LPsGWNxuQfToPpKfIxIJUrjLVSH3pLeIWMvCNPKx4k8bZoPa/elon.jpeg",
input_image: "https://replicate.delivery/pbxt/LPsGWYhFW03GN2y21RDRlat7YBCVPupkwyEg3Ca0YxcFWYNE/images.jpeg"
}
}
);
// To access the file URL:
console.log(output.url()); //=> "http://example.com"
// To write the file to disk:
fs.writeFile("my-image.png", output);
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 cdingram/face-swap using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"cdingram/face-swap:d1d6ea8c8be89d664a07a457526f7128109dee7030fdac424788d762c71ed111",
input={
"swap_image": "https://replicate.delivery/pbxt/LPsGWNxuQfToPpKfIxIJUrjLVSH3pLeIWMvCNPKx4k8bZoPa/elon.jpeg",
"input_image": "https://replicate.delivery/pbxt/LPsGWYhFW03GN2y21RDRlat7YBCVPupkwyEg3Ca0YxcFWYNE/images.jpeg"
}
)
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 cdingram/face-swap 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": "cdingram/face-swap:d1d6ea8c8be89d664a07a457526f7128109dee7030fdac424788d762c71ed111",
"input": {
"swap_image": "https://replicate.delivery/pbxt/LPsGWNxuQfToPpKfIxIJUrjLVSH3pLeIWMvCNPKx4k8bZoPa/elon.jpeg",
"input_image": "https://replicate.delivery/pbxt/LPsGWYhFW03GN2y21RDRlat7YBCVPupkwyEg3Ca0YxcFWYNE/images.jpeg"
}
}' \
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": "2024-08-09T15:48:40.358146Z",
"created_at": "2024-08-09T15:47:05.678000Z",
"data_removed": false,
"error": null,
"id": "y1t1wdbq9srj20ch6z9a65adzw",
"input": {
"swap_image": "https://replicate.delivery/pbxt/LPsGWNxuQfToPpKfIxIJUrjLVSH3pLeIWMvCNPKx4k8bZoPa/elon.jpeg",
"input_image": "https://replicate.delivery/pbxt/LPsGWYhFW03GN2y21RDRlat7YBCVPupkwyEg3Ca0YxcFWYNE/images.jpeg"
},
"logs": "/root/.pyenv/versions/3.10.14/lib/python3.10/site-packages/insightface/utils/transform.py:68: FutureWarning: `rcond` parameter will change to the default of machine precision times ``max(M, N)`` where M and N are the input matrix dimensions.\nTo use the future default and silence this warning we advise to pass `rcond=None`, to keep using the old, explicitly pass `rcond=-1`.\nP = np.linalg.lstsq(X_homo, Y)[0].T # Affine matrix. 3 x 4\n(225, 225, 3) None None",
"metrics": {
"predict_time": 10.045267251,
"total_time": 94.680146
},
"output": "https://replicate.delivery/yhqm/FzprOdEX7nK4PJaEtoJQwn2i3azvGUUFWIfBXnEzEsGsYfQTA/1723218520.jpg",
"started_at": "2024-08-09T15:48:30.312879Z",
"status": "succeeded",
"urls": {
"get": "https://api.replicate.com/v1/predictions/y1t1wdbq9srj20ch6z9a65adzw",
"cancel": "https://api.replicate.com/v1/predictions/y1t1wdbq9srj20ch6z9a65adzw/cancel"
},
"version": "d1d6ea8c8be89d664a07a457526f7128109dee7030fdac424788d762c71ed111"
}
/root/.pyenv/versions/3.10.14/lib/python3.10/site-packages/insightface/utils/transform.py:68: FutureWarning: `rcond` parameter will change to the default of machine precision times ``max(M, N)`` where M and N are the input matrix dimensions.
To use the future default and silence this warning we advise to pass `rcond=None`, to keep using the old, explicitly pass `rcond=-1`.
P = np.linalg.lstsq(X_homo, Y)[0].T # Affine matrix. 3 x 4
(225, 225, 3) None None