Faceswap

Take a picture/gif and replace the face in it with a face of your choice. You only need one image of the desired face. No dataset, no training


API

If you're looking for an API, you can choose from your desired programming language.

POST
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 import requests import base64 # Use this function to convert an image file from the filesystem to base64 def image_file_to_base64(image_path): with open(image_path, 'rb') as f: image_data = f.read() return base64.b64encode(image_data).decode('utf-8') # Use this function to fetch an image from a URL and convert it to base64 def image_url_to_base64(image_url): response = requests.get(image_url) image_data = response.content return base64.b64encode(image_data).decode('utf-8') api_key = "YOUR_API_KEY" url = "https://api.segmind.com/v1/sd2.1-faceswapper" # Request payload data = { "input_face_image": image_url_to_base64("https://www.segmind.com/elon.jpg"), # Or use image_file_to_base64("IMAGE_PATH") "target_face_image": image_url_to_base64("https://www.segmind.com/burn.gif"), # Or use image_file_to_base64("IMAGE_PATH") "file_type": "gif", "face_restore": True } headers = {'x-api-key': api_key} response = requests.post(url, json=data, headers=headers) print(response.content) # The response is the generated image
RESPONSE
image/jpeg
HTTP Response Codes
200 - OKImage Generated
401 - UnauthorizedUser authentication failed
404 - Not FoundThe requested URL does not exist
405 - Method Not AllowedThe requested HTTP method is not allowed
406 - Not AcceptableNot enough credits
500 - Server ErrorServer had some issue with processing

Attributes


input_face_imageimage *

Your face goes here. A closeup shot would be ideal.


target_face_imageimage *

The face you want to swap with. Can be a gif too.


file_typestr ( default: png )

File type of the face you want to swap with.


face_restorebool ( default: true )

Run result frames through codeformer face restoration

To keep track of your credit usage, you can inspect the response headers of each API call. The x-remaining-credits property will indicate the number of remaining credits in your account. Ensure you monitor this value to avoid any disruptions in your API usage.

GIF Faceswap

GIF Faceswap is an innovative application aimed at making the process of character animation and customization as seamless as possible. With this model, you no longer need a dataset or extensive training to bring your creations to life. By taking a GIF and a single image of the face you wish to incorporate, GIF Faceswap transforms your static image into a dynamic character, effectively "swapping" the face within the GIF. This unique application enables artists, designers, and creatives to animate a custom character or utilize the character as a model for clothing designs, amongst other potential uses.

The underlying technology behind GIF Faceswap is InsightFace, a versatile 2D and 3D face analysis project, highly optimized framework that implements a myriad of state-of-the-art algorithms for face recognition, detection, and alignment. It serves as the backbone of GIF Faceswap, providing the necessary capabilities to identify and manipulate facial structures within a GIF and the input image. This makes the process of faceswapping extremely efficient and accurate, as the model leverages these algorithms to seamlessly integrate your desired face into the GIF.

GIF Faceswap offers numerous advantages that make it an excellent tool for a wide range of applications. Its primary advantage is its ability to replace a face in a GIF using just a single image, eliminating the need for a dataset or extensive training. This makes the model highly accessible and easy to use, even for those without extensive technical knowledge. Moreover, GIF Faceswap can significantly speed up the process of character animation and customization, making it an invaluable tool for artists, animators, and fashion designers.

GIF Faceswap use cases

  1. Character Animation: Artists can use GIF Faceswap to animate custom characters for use in digital media, such as games and animations.

  2. Fashion Design: Designers can use the model to swap the faces of models in GIFs, allowing them to showcase their clothing designs on various characters.

  3. Custom Emoji Creation: Individuals can create personalized emoji by swapping their face into existing GIFs.

  4. Marketing and Advertising: Businesses can use GIF Faceswap to create unique advertisements featuring their brand mascot or spokesperson in various scenarios.

  5. Educational Purposes: Educators can use GIF Faceswap to create engaging visual aids, such as historical figures in reenacted scenes.

GIF Faceswap license

GIF Faceswap is covered under the GNU General Public License v3.0, a strong copyleft license. Under this license, users are allowed to copy, modify, and distribute the software. However, they are required to make the complete source code of the licensed works and any modifications available under the same license. This means that if you make changes to the software and distribute it, you must also distribute the modified source code under the GNU General Public License. All copyright and license notices must be preserved, and contributors provide an express grant of patent rights.