This project is a Streamlit web application that allows users to perform face swapping between images. Users can upload a source image and a target face image, detect faces in the source image, and select a specific face to swap with the target face.
face-swap-app
├── app.py # Main entry point of the Streamlit application
├── utils # Utility functions for face detection and swapping
│ ├── __init__.py # Initialization file for the utils module
│ └── face_swap.py # Contains functions for face detection and swapping
├── models # Directory containing pre-trained models
│ └── inswapper_128.onnx # Pre-trained model for face swapping
├── requirements.txt # Lists the dependencies required for the project
└── README.md # Documentation for the project
-
Clone the repository:
git clone <repository-url> cd face-swap-app
-
Install the required dependencies: It is recommended to use a virtual environment. You can create one using
venv
orconda
.pip install -r requirements.txt
-
Run the application: Start the Streamlit application by running:
streamlit run app.py
- Upload a source image that contains one or more faces.
- Upload a target face image that you want to swap with.
- Select the "Multiple face" option to detect and display faces in the source image.
- Choose a face ID from the detected faces for swapping.
- The application will display the result of the face swap operation.
The project requires the following Python packages:
- Streamlit
- OpenCV
- InsightFace
Make sure to install all dependencies listed in requirements.txt
before running the application.
This project is licensed under the MIT License. See the LICENSE file for more details.