Skip to content

davift/Inpainting

Repository files navigation

inpainting

Inpainting is a technique of selectively modifying parts of an image guided by prompts, using an input image and a mask to define the area to be changed.

Disclaimer: The code in this repository is capable of downloading and running multiple *uncensored models. Use with resposibility and respect!

Content of the readme.

  • Container
    • Build, Run, and Manage
  • Applications/Scripts
    • Benchmarking
      • Runs the same batch of prompts against all models for comparison.
    • CLI
      • Can generates muiltiple images fromt he same prompt,
      • Easy to integrate with other apps or automations,
      • Has a randomizer function for parameters (strength and guidance).
    • Web-UI
      • (incomplete)

Container

This container image includes all the required libraries and dependencies to run the models and scripts without any hassle. It is build based on PyTorch v2.1.2 for compatibility with NVIDIA Tesla P4 (Pascal architecture).

Build

docker build -t inpainting:v1.0 .

Run in Background

docker run -itd --gpus all -v $(pwd):/app -v $(pwd)/../models:/models -p 7860:7860 --name Inpainting inpainting:v1.0

Run in Background with Web-UI

docker run --rm -itd --gpus all -v $(pwd):/app -v $(pwd)/../models:/models -p 7860:7860 -e INDEX=0,1 --name Inpainting inpainting:v1.0 /app/app.py

Managing

docker exec -it Inpainting bash
docker logs -f Inpainting
docker stop Inpainting
docker rm Inpainting

Application

Benchmarking

Running

./benchmark.py

CLI

Usage

INDEX=M,N python app.py input_image input_mask [prompt] [num_images] [num_saved_steps]

Note: INDEX refers to the model to be used, see code.

Examples

./app.py girl.png mask.png "dressed like a cat"
./app.py car.png car_mask.png "giant tires" 3
INDEX=1,0 ./app.py car.png car_mask.png "futuristic scenario" 0

Web-UI

./app.py

Navigate to http://IP:7860/

Avoid Duplication

This will rename all files to its MD5 hash to prevent duplication and tampering.

for f in *.png; do [ -f "$f" ] && h=$(md5sum "$f" | cut -d ' ' -f1) && mv -n -- "$f" "$h.png"; done

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors