Skip to content

A simple web application that lets you replace any part of an image with an image generated based on your description.

Notifications You must be signed in to change notification settings

foxmoon/Replace-Anything

 
 

Repository files navigation

ReplaceAnything

ReplaceAnything as you want: Ultra-high quality content replacement

Binghui Chen, Chao Li, Chongyang Zhong, Wangmeng Xiang, Yifeng Geng, Xuansong Xie

Institute for Intelligent Computing, Alibaba Group

News: Now you can try our ReplaceAnything v1.0 on HuggingFace space ( in English ) . Enjoy it and have fun!

News: Now you can try our ReplaceAnything v1.0 on ModelScope 魔搭 ( in Chinese ) . Enjoy it and have fun!

Feel free to share your interesting results with us. If you have any questions or suggestions, don't hesitate to leave a message in issues.

To Do Lists:

  • Paper release
  • Code release

Note: Please don't forget to give us a star if you like this project. Thanks! 😜


Also you can try it at replaceanything.best

Clothing replacement (masked region is strictly retained):

replaceanything

Background replacement for ID photo and family photo (masked region is strictly retained):

replaceanything

Replace Anything App You can run by yourself

A simple web application that lets you replace any part of an image with an image generated based on your description.

Demo

✂️ Generate a mask using the Segment Anything Model (SAM) by Meta AI Research. SAM is able to accurately identify and isolate the specific areas of the image that you want to edit.

Original Segmented

🎨 Replace the specific parts of the image based on a text prompt using Diffusers library Inpaint Pipeline by Hugging Face. This ensures smooth and seamless blending of the edited portions with the rest of the image, resulting in a natural and realistic final product.

Mask Replaced

🍱 Serve the application and models with Gradio on BentoML.

Getting Started

First download the trained model checkpoint ViT-H SAM model.

./download_model.sh

Before running the scripts, make sure you install the dependencies.

pip install -r requirements.txt

Use bentoml to serve the model.

bentoml serve

You can access the WebUI through the /interface endpoint. The root / path is the Swagger debugging page provided by BentoML.

This project is intended for research purposes only and is not intended for commercial use or profit. This project is based on two open source models, Meta Segment Anything and Stable Diffusion, which are made available under the respective licenses.

About

A simple web application that lets you replace any part of an image with an image generated based on your description.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 98.3%
  • Shell 1.7%