7.0 KiB
7.0 KiB
In [ ]:
from os import path
import torchIn [ ]:
!git clone -b FastAIv1 --single-branch https://github.com/jantic/DeOldify.git DeOldify
#!git clone https://github.com/jantic/DeOldify.git DeOldify In [ ]:
cd DeOldifyIn [ ]:
!pip install -r requirements.txtIn [ ]:
import fastai
from fasterai.visualize import *
from pathlib import Path
torch.backends.cudnn.benchmark=TrueIn [ ]:
!mkdir 'models'
!wget wget https://www.dropbox.com/s/zkehq1uwahhbc2o/ColorizeArtistic_gen.pth?dl=0 -O ./models/ColorizeArtistic_gen.pthIn [ ]:
colorizer = get_image_colorizer(artistic=True)In [ ]:
source_url = '' #@param {type:"string"}
render_factor = 35 #@param {type: "slider", min: 7, max: 45}
if source_url is not None and source_url !='':
image_path = colorizer.plot_transformed_image_from_url(url=source_url, render_factor=render_factor, compare=True)
show_image_in_notebook(image_path)
else:
print('Provide an image url and try again.')In [ ]:
for i in range(10,46,2):
colorizer.plot_transformed_image('test_images/image.png', render_factor=i, display_render_factor=True, figsize=(8,8))