Skip to content
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

adding dockerfile and instructions for running in docker in windows #28

Open
wants to merge 1 commit 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
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM pytorch/pytorch:1.0.1-cuda10.0-cudnn7-runtime

# Install things needed for easygui, tkinter and opencv
RUN apt-get update -y && \
apt-get install -y build-essential libsm6 libxext6 libxrender-dev libxrender1 libfontconfig1 tk libglib2.0-0

RUN pip install --upgrade pip

ADD . /app

WORKDIR /app

RUN pip install -r requirements.txt

#CMD ["python" "tool_draw.py" "-p" "models/getchu-anime" "-r"]
13 changes: 13 additions & 0 deletions Dockerfile_tkinter
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Slim version of Python
FROM python:3.8.12-slim

# Download Package Information
RUN apt-get update -y

# Install Tkinter
RUN apt-get install tk -y

RUN pip install easygui==0.98.1
# Commands to run Tkinter application
CMD ["/app/tkinter_app.py"]
ENTRYPOINT ["python3"]
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,3 +211,16 @@ Code structure is modified from [Anime-InPainting](https://github.com/youyuge34/
year={2019}
}
```


build by `docker build --progress=plain -t pirec .`, run by
`docker run -u=$(id -u $USER):$(id -g $USER) -e DISPLAY=$DISPLAY -e MPLBACKEND='Agg' -v /tmp/.X11-unix:/tmp/.X11-unix:rw --gpus=all pirec python tool_draw.py -p models/getchu-anime -r`

on windows host, run x server, e.g. https://medium.com/@potatowagon/how-to-use-gui-apps-in-linux-docker-container-from-windows-host-485d3e1c64a3


testing basic python gui stuff before we make this all work:
```bash
docker build -f Dockerfile_tkinter --progress=plain -t tkinter_in_docker .
docker run -u=$(id -u $USER):$(id -g $USER) -e PYTHONIOENCODING=UTF-8 -e DISPLAY=$DISPLAY -e MPLBACKEND='Agg' -v /tmp/.X11-unix:/tmp/.X11-unix:rw --gpus=all pirec python tool_draw.py -p models/getchu-anime -r
```
2 changes: 1 addition & 1 deletion USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ both lead to the awful edges.
2. **Drawing from color domain and edge (Recommended).** <br>
We strongly recommend you to start drawing using this mode. Some anime edges and color domains are provided drawn by myself in `./examples/getchu`. If you use examples from `./examples/getchu`, you need to run the corresponding command:
```bash
python tool_draw.py -p models/getchu-anime -r
python tool_draw.py -p models/getchu-anime -r
```
You can also get more edges and color domains by yourself using the **Command Line Mode** above. The testing results contain extracted edges and color domains by default (`DEBUG: 1` in `config.yml`). If you are not interested in the edges and color domains drawn by myself, using the edges and color domains from testing results may be a good choice.

Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ pyaml
future==0.16.0
scikit-image
pyparsing
torchvision==0.2.2
19 changes: 19 additions & 0 deletions tkinter_app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import tkinter as tk

from easygui import *
# Tkinter Window
root_window = tk.Tk()

# Window Settings
root_window.title('Application Title')
root_window.geometry('300x100')
root_window.configure(background = '#353535')

# Text
tk.Label(root_window, text='Hello World', fg='White', bg='#353535').pack()

# Exit Button
tk.Button(root_window, text='Exit', width=10, command=root_window.destroy).pack()

# Main loop
root_window.mainloop()
5 changes: 2 additions & 3 deletions tool_draw.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,11 @@
===============================================================================
"""

# Python 2/3 compatibility
from __future__ import print_function

import argparse
import glob

# we need to import tkinter before easygui, because reasons https://stackoverflow.com/questions/66355637/pycharm-error-with-easygui-no-module-named-global-state
import tkinter
from easygui import *
import numpy as np
import cv2 as cv
Expand Down