Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM pytorch/pytorch:2.3.1-cuda12.1-cudnn8-runtime

WORKDIR /app

# Install system dependencies
ENV DEBIAN_FRONTEND=noninteractive
# RUN sed -i 's/archive.ubuntu.com/hk.archive.ubuntu.com/g' /etc/apt/sources.list
RUN apt-get update && apt-get install -y git git-lfs ffmpeg libgl1 && rm -rf /var/lib/apt/lists/*

COPY . .

RUN pip install --upgrade pip setuptools wheel \
&& pip install -r requirements/requirements.txt

ENV GRADIO_SERVER_NAME=0.0.0.0

EXPOSE 7860

CMD ["python", "app.py", "--version", "ppt-v2", "--checkpoint_dir", "checkpoints/ppt-v2", "--local_files_only" ]
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ PowerPaint is a high-quality versatile image inpainting model that supports text

```bash
# Clone the Repository
git clone git@github.com:open-mmlab/PowerPaint.git
git clone https://github.com/davideuler/PowerPaint.git

# Create Virtual Environment with Conda
conda create --name ppt python=3.9
Expand All @@ -76,20 +76,21 @@ You can launch the Gradio interface for PowerPaint by running the following comm
```bash
# Set up Git LFS
conda install git-lfs
git lfs install
apt install git-lfs

# Clone PowerPaint Model
git lfs clone https://huggingface.co/JunhaoZhuang/PowerPaint-v1/ ./checkpoints/ppt-v1
git clone https://huggingface.co/JunhaoZhuang/PowerPaint-v1/ ./checkpoints/ppt-v1

python app.py --share
python app.py
```

For the BrushNet-based PowerPaint, you can run the following command:
```bash
# Clone PowerPaint Model
git lfs clone https://huggingface.co/JunhaoZhuang/PowerPaint_v2/ ./checkpoints/ppt-v2
git clone https://huggingface.co/JunhaoZhuang/PowerPaint_v2/ ./checkpoints/ppt-v2
ln -sf `pwd`/checkpoints/ppt-v2/realisticVisionV60B1_v51VAE/unet/diffusion_pytorch_model-002.bin checkpoints/ppt-v2/realisticVisionV60B1_v51VAE/unet/diffusion_pytorch_model.bin

python app.py --share --version ppt-v2 --checkpoint_dir checkpoints/ppt-v2
python app.py --version ppt-v2 --checkpoint_dir checkpoints/ppt-v2 --local_files_only
```

### Text-Guided Object Inpainting
Expand Down
21 changes: 21 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
services:
powerpaint:
build:
context: .
dockerfile: Dockerfile
image: powerpaint
command: python app.py --version ppt-v2 --checkpoint_dir checkpoints/ppt-v2 --local_files_only
ports:
- "${MAPPED_HOST_PORT_POWERPAINT}:7860"
environment:
- GRADIO_SERVER_NAME=0.0.0.0
volumes:
- ~/models/powerpaint/checkpoints:/app/checkpoints
- ~/.cache:/root/.cache
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]
11 changes: 6 additions & 5 deletions requirements/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
accelerate
accelerate==1.7.0
controlnet-aux==0.0.3
diffusers==0.27.0
gradio==3.41.0
mmengine
gradio==3.43.0
mmengine==0.10.7
opencv-python
torch
torchvision
torch==2.3.1
torchvision==0.18.1
transformers==4.28.0
huggingface-hub==0.25.2
4 changes: 4 additions & 0 deletions run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

(mkdir -p ~/models/powerpaint/ && cd ~/models/powerpaint/ && git clone https://huggingface.co/JunhaoZhuang/PowerPaint_v2/ ./checkpoints/ppt-v2)

docker-compose up -d