8.2 KiB
8.2 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 os
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
from google.colab import auth
from oauth2client.client import GoogleCredentials
from google.colab import drive
import fastai
from fasterai.visualize import *
from pathlib import Path
from itertools import repeat
from google.colab import drive
from google.colab import files
torch.backends.cudnn.benchmark=TrueIn [ ]:
!mkdir 'models'
!wget https://www.dropbox.com/s/zqt6pzcmoztda0l/ColorizeVideos_gen2.pth?dl=0 -O ./models/ColorizeVideos_gen2.pthIn [ ]:
render_factor = 36 #@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:
#UPLOAD File Here
source_media = files.upload()
os.system('ln -s /content/WORKFOLDER/' + list(source_media.keys())[0] + ' ' + source_path)
colorizer.colorize_from_file_name(file_name)