From 44b57ef449763e2a16ec505a7037506ba77ebada Mon Sep 17 00:00:00 2001 From: "ramon.rocap@gmail.com" <119916375+RRocaP@users.noreply.github.com> Date: Sun, 29 Dec 2024 06:55:06 +0100 Subject: [PATCH 1/2] Dockerize repo to run on Hugging Face --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/BachiLi/diffvg?shareId=XXXX-XXXX-XXXX-XXXX). --- .dockerignore | 7 +++++++ Dockerfile | 23 +++++++++++++++++++++++ README.md | 18 ++++++++++++++++++ huggingface_config.json | 23 +++++++++++++++++++++++ 4 files changed, 71 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 huggingface_config.json diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..f84d3b59 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,7 @@ +.git +__pycache__ +*.pyc +build +dist +*.egg-info +.DS_Store diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..d5f7eea2 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +# Use the official Python image as a parent image +FROM python:3.8-slim + +# Set the working directory in the container +WORKDIR /app + +# Copy the current directory contents into the container at /app +COPY . /app + +# Install any needed packages specified in requirements.txt +RUN pip install --no-cache-dir -r requirements.txt + +# Install necessary dependencies +RUN apt-get update && apt-get install -y \ + cmake \ + ffmpeg \ + && rm -rf /var/lib/apt/lists/* + +# Install the project +RUN python setup.py install + +# Set the entry point to run the project on Hugging Face +ENTRYPOINT ["python", "single_circle.py"] diff --git a/README.md b/README.md index 6c01273e..78059e2f 100644 --- a/README.md +++ b/README.md @@ -138,6 +138,24 @@ For the GAN models, see `apps/generative_models/train_gan.py`. Generate samples For the VAE models, see `apps/generative_models/mnist_vae.py`. +# Docker + +## Build Docker image + +To build the Docker image, run the following command: + +``` +docker build -t diffvg . +``` + +## Run Docker container + +To run the Docker container, use the following command: + +``` +docker run -it --rm diffvg +``` + If you use diffvg in your academic work, please cite ``` diff --git a/huggingface_config.json b/huggingface_config.json new file mode 100644 index 00000000..6865c95b --- /dev/null +++ b/huggingface_config.json @@ -0,0 +1,23 @@ +{ + "model": "diffvg", + "version": "0.1.0", + "entry_point": "single_circle.py", + "dependencies": [ + "torch", + "torchvision", + "numpy", + "scikit-image", + "svgwrite", + "svgpathtools", + "cssutils", + "numba", + "torch-tools", + "visdom", + "cmake", + "ffmpeg" + ], + "environment": { + "python_version": "3.8", + "os": "linux" + } +} From afed7bd2214b8be9c11455eb8e98078ef7465ef8 Mon Sep 17 00:00:00 2001 From: "ramon.rocap@gmail.com" <119916375+RRocaP@users.noreply.github.com> Date: Sun, 29 Dec 2024 06:59:19 +0100 Subject: [PATCH 2/2]