Skip to content

Commit

Permalink
feat: added simple Dockerfile to quickly run gradio app and instructi…
Browse files Browse the repository at this point in the history
…ons; fixed version in pip requirements.txt
  • Loading branch information
merryHunter committed Jun 28, 2023
1 parent a3303cd commit 9db0ab9
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 5 deletions.
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM nvcr.io/nvidia/pytorch:23.05-py3

ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

RUN apt-get update && apt-get install -y --no-install-recommends \
make \
pkgconf \
xz-utils \
xorg-dev \
libgl1-mesa-dev \
libglu1-mesa-dev \
libxrandr-dev \
libxinerama-dev \
libxcursor-dev \
libxi-dev \
libxxf86vm-dev

RUN pip install --upgrade pip

COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt

WORKDIR /workspace

RUN (printf '#!/bin/bash\nexec \"$@\"\n' >> /entry.sh) && chmod a+x /entry.sh
ENTRYPOINT ["/entry.sh"]
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,19 @@ cat environment.yml | \
grep -v -E 'nvidia|cuda' > environment-no-nvidia.yml && \
conda env create -f environment-no-nvidia.yml
conda activate stylegan3
```

## Run Gradio visualizer in Docker

Provided docker image is based on NGC PyTorch repository. To quickly try out visualizer in Docker, run the following:

```sh
docker build . -t draggan:latest
docker run -v "$PWD":/workspace/src -it draggan:latest bash
cd src && python visualizer_drag_gradio.py
```
Now you can open a shared link from Gradio (printed in the terminal console).
Beware the Docker image takes about 25GB of disk space!

# On MacOS
export PYTORCH_ENABLE_MPS_FALLBACK=1
Expand Down
14 changes: 9 additions & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
torch
torchvision
Ninja
gradio
torch>=2.0.0
scipy==1.11.0
Ninja==1.10.2
gradio>=3.35.2
imageio-ffmpeg>=0.4.3
huggingface_hub
hf_transfer
pyopengl
imgui
glfw
glfw==2.6.1
pillow>=9.4.0
torchvision>=0.15.2
imageio>=2.9.0

0 comments on commit 9db0ab9

Please sign in to comment.