Gradio based playground web UI using facebook/segment-anything-2 models.
- Segment video for transparent background or pixelated object
| Transparent background |
Transparent.background.mp4 |
| Pixelate |
Pixelate.mp4 |
- Segment image to divide objects into layers and save them as PSD files.
| Divide clothes into layers and save as PSD file |
|
See PROMPT_GUIDE.md to see how to prompt the segmentation parts of the image.
To run this Web UI, you need these prerequisites. If you don't have them, please install them in the following links :
git: https://git-scm.com/downloadspython=>3.10: https://www.python.org/downloads/FFmpeg: https://ffmpeg.org/download.html
After installing FFmpeg, make sure to add the FFmpeg/bin folder to your system PATH!
And for CUDA, if you're not using an Nvidia GPU and CUDA 12.4, edit the requirements.txt to match your environment.
There's a set of shell / batch scripts for installation and running.
- Download
sam2-playground-portable.zipwith the file corresponding to your OS and extract its contents. - Run
install.batorinstall.shto install dependencies. (It will create avenvdirectory and install dependencies there.) - Start WebUI with
start-webui.batorstart-webui.sh(It will runpython app.pyafter activating thevenv) - To update, run
update.batorupdate.sh(It will rungit pull origin master)
- Clone the repository
git clone https://github.com/jhj0517/sam2-playground.git
- Build the image ( Image is about ~6 GB )
docker compose build
- Run the container
docker compose up
- Connect to
localhost:7860with your browser.
If needed, update docker-compose.yaml to match your environments.
- Support
change()API forgradio_image_prompterand automatically generate preview for video predictor
