This application uses the ClipSeg and Stable Diffusion models to identify and transform elements in images.
demo.mp4
- Identify elements in images using ClipSeg
- Transform identified elements using Stable Diffusion
- Display the transformed images in the application
- Load an image into the application.
- Enter the prompts for the elements you want to identify in the image.
- The application will use ClipSeg to identify the elements in the image and display the masks for each element.
- Enter the prompts for how you want to transform the identified elements.
- The application will use Stable Diffusion to transform the identified elements and display the transformed images.
-
process_with_clipseg(clip_model, tensor_image, target_prompts)
: This function uses the ClipSeg model to identify elements in the image based on the target prompts. It returns the masks for the identified elements. -
process_with_stable_diffusion(diffusion_pipe, source_image, stable_diffusion_masks, target_prompts, inpainting_prompts)
: This function uses the Stable Diffusion model to transform the identified elements based on the inpainting prompts. It returns the transformed images.
- Clone the repository.
git clone https://github.com/timojl/clipseg.git
- Install the required packages using pip:
pip install -r requirements.txt
- Run the application:
streamlit run main.py
This application is intended for educational and research purposes. Please use responsibly.