Skip to content

Dockerize repo to run on Hugging Face #91

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.git
__pycache__
*.pyc
build
dist
*.egg-info
.DS_Store
23 changes: 23 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

```
Expand Down
23 changes: 23 additions & 0 deletions huggingface_config.json
Original file line number Diff line number Diff line change
@@ -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"
}
}