Skip to content

Commit

Permalink
now include stable colorize model, closes #16
Browse files Browse the repository at this point in the history
  • Loading branch information
bpops committed Jun 16, 2020
1 parent 30a8e5d commit 996c24f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Expand Up @@ -11,4 +11,4 @@ fastai==1.0.51
ffmpeg==1.4
ipython==7.15.0
Pillow==7.1.2
tensorboardX==2.0
tensorboardX==2.0
21 changes: 17 additions & 4 deletions timeslide.py
Expand Up @@ -13,16 +13,14 @@
from deoldify import device
from deoldify.device_id import DeviceId
device.set(device = DeviceId.GPU0)

from deoldify.visualize import *
torch.backends.cudnn.benchmark = True
colorizer = get_image_colorizer(artistic=True)

# other modules
import tkinter as tk
import tkinter.filedialog
from tkinter import ttk
from PIL import ImageTk, Image
from PIL import Image, ImageTk
import shutil
import os
import urllib.request
Expand Down Expand Up @@ -105,12 +103,21 @@ def init_window(self):
variable=self.colorize_int, offvalue=0, onvalue=1)
chk_colorize.pack(side=tk.LEFT)

# colorize model dropdown
self.model_vars = tk.StringVar(frame_colorize)
self.model_vars.set("Stable")
model_label = tk.Label(frame_colorize, text='Model:', bg=bg_color)
model_label.pack(side=tk.LEFT, padx=(15,0))
self.colorize_model = tk.OptionMenu(frame_colorize, self.model_vars,
"Stable", "Artistic")
self.colorize_model.pack(side=tk.LEFT, padx=0)

# colorize render factor
min_rndr_fctr = 7
max_rndr_fctr = 45
self.scale_rf = tk.Scale(frame_colorize,
from_=min_rndr_fctr, to=max_rndr_fctr, orient="horizontal",
length=300, bg=bg_color)
length=150, bg=bg_color)
self.scale_rf.pack(side=tk.RIGHT, fill="x")
self.scale_rf.set(30)
label_rf = ttk.Label(frame_colorize, text="Render Factor: ",
Expand Down Expand Up @@ -178,6 +185,12 @@ def timeslide(self):
# do colorization
if (self.colorize_int.get() == 1):

# determine colorizer model
if (self.model_vars.get() == "Artistic"):
colorizer = get_image_colorizer(artistic=True)
elif (self.model_vars.get() == "Stable"):
colorizer = get_image_colorizer(artistic=False)

# get render factor
render_factor = self.scale_rf.get()

Expand Down

0 comments on commit 996c24f

Please sign in to comment.