mirror of
https://github.com/jantic/DeOldify.git
synced 2026-11-03 22:44:30 +08:00
8.5 KiB
8.5 KiB
In [ ]:
from os import path
import torch
print(torch.__version__)
print(torch.cuda.is_available())In [ ]:
!git clone -b FastAIv1 --single-branch https://github.com/jantic/DeOldify.git DeOldify
#!git clone https://github.com/jantic/DeOldify.git DeOldifyIn [ ]:
cd DeOldifyIn [ ]:
!pip install PyDrive
!pip install ffmpeg-python
!pip install youtube-dl
!pip install tensorboardXIn [ ]:
import fastai
from fasterai.visualize import *
from pathlib import Path
from google.colab import drive
from google.colab import files
torch.backends.cudnn.benchmark=TrueIn [ ]:
!mkdir 'models'
!wget https://www.dropbox.com/s/ztgygpaz1z3jkjg/ColorizeImagesStable_gen.pth?dl=0 -O ./models/ColorizeImagesStable_gen.pthIn [ ]:
render_factor = 21 #@param {type: "slider", min: 5, max: 45}In [ ]:
source_url = '' #@param {type:"string"}In [ ]:
file_name = 'video.mp4'
source_dir = './video/source/'
source_path = source_dir + file_name
dest_dir = './video/result/'
dest_path = dest_dir + file_nameIn [ ]:
!mkdir file_dirIn [ ]:
colorizer = get_video_colorizer(render_factor=render_factor)In [ ]:
if source_url is not None and source_url !='':
colorizer.colorize_from_url(source_url, file_name)
else:
print('Provide a source url and try again.')