Spaces:
Runtime error
Runtime error
File size: 807 Bytes
0513aaf |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
import gradio as gr
import utils
from PIL import Image
import torch
import math
from torchvision import transforms
device = "cpu"
years = [str(y) for y in range(1880, 2020, 10)]
orig_models = {}
for year in years:
G, w_avg = utils.load_stylegan2(f"pretrained_models/{year}.pkl", device)
orig_models[year] = { "G": G.eval()}
transform = transforms.Compose([
transforms.Resize((256, 256)),
transforms.ToTensor(),
transforms.Normalize([0.5, 0.5, 0.5], [0.5, 0.5, 0.5])])
# Download human-readable labels for ImageNet.
def predict(inp):
#with torch.no_grad():
return inp
gr.Interface(fn=predict,
inputs=gr.Image(type="pil"),
outputs=gr.Image(type="pil"),
#examples=["lion.jpg", "cheetah.jpg"]
).launch()
|