Skip to content

Winner960111/Image-to-Image

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🌀 FaceSwap Image-to-Image Project

Effortlessly swap faces between two images using the PiAPI FaceSwap API and Python! This project demonstrates how to automate face-swapping with just a few lines of code—perfect for developers, content creators, or anyone interested in generative AI.


🚀 Features

  • Automated face-swapping between two images via API
  • Asynchronous job handling: submit a swap, then fetch the result
  • Simple, readable Python code
  • Easily customizable for your own images or workflows

🖼️ How It Works

  1. Send a POST request to the FaceSwap API with your source and target image URLs.
  2. Receive a Task ID to track your swap job.
  3. Poll the API for the result using the Task ID.
  4. Get a URL to your face-swapped image when the job is done.

📝 Prerequisites

  • Python 3.7+
  • PiAPI FaceSwap API Key (sign up for free credits!)
  • python-dotenv for managing secrets (pip install python-dotenv)
  • Internet connection for API calls

⚡ Quick Start

  1. Clone this repo and install dependencies:

pip install python-dotenv

  1. Run the script with your chosen image URLs!

💻 Example Code


🛠️ Customization

  • Change the source and swap URLs to your own images.
  • Adjust max_retries or retry_delay in get_result() for longer or shorter polling.

📦 API Reference

  • Endpoint: POST /api/face_swap/v1/async
    Submit your swap job with target_image and swap_image (URLs).
  • Endpoint: POST /api/face_swap/v1/fetch
    Retrieve the result using task_id.

Note: Each image should contain only one visible face for best results[1][2][3].


🧑‍💻 Use Cases

  • Social media filters
  • Entertainment apps
  • Profile picture customization
  • Generative AI projects

📄 License

This project is for educational and non-commercial use. For commercial deployments, refer to PiAPI's Terms of Service.


🙌 Credits

  • Powered by [PiAPI FaceSwap API][1][3]
  • Inspired by [Hugging Face Model Card][1]

Start swapping faces—let your creativity run wild!


  1. https://huggingface.co/PiAPI/Faceswap-API
  2. https://piapi.ai/blogs/how-to-use-faceswap-api-from-piapi-with-postman
  3. https://piapi.ai/faceswap-api

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages