Last active
March 11, 2023 02:00
-
-
Save YiLi225/7745014cd122037c980e42a3cbe2e9e0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import Image | |
import torch | |
import IPython | |
from IPython.display import display | |
# upload images | |
from google.colab import files | |
uploaded = files.upload() | |
# https://github.com/bryandlee/animegan2-pytorch | |
# load models and face2paint utility function | |
model_facev2 = torch.hub.load("bryandlee/animegan2-pytorch:main", "generator", pretrained="face_paint_512_v2") | |
face2paint = torch.hub.load("bryandlee/animegan2-pytorch:main", "face2paint", size=512) | |
for INPUT_IMG in ['KatLi.JPG']: | |
img = Image.open(INPUT_IMG).convert("RGB") | |
out_facev2 = face2paint(model_facev2, img) | |
# display images | |
display(img) | |
display(out_facev2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment