Skip to content

Instantly share code, notes, and snippets.

@cvalenzuela
Last active July 31, 2019 13:23
Show Gist options
  • Save cvalenzuela/7764d952edced871027e76fa383adf56 to your computer and use it in GitHub Desktop.
Save cvalenzuela/7764d952edced871027e76fa383adf56 to your computer and use it in GitHub Desktop.
import torch
+ import runway
+ import numpy as np

use_gpu = True if torch.cuda.is_available() else False

# Load the model from the Pytorch Hub
model = torch.hub.load('facebookresearch/pytorch_GAN_zoo:hub',
                       'PGAN', model_name='celebAHQ-512',
                       pretrained=True, useGPU=use_gpu)

# Generate one image
noise, _ = model.buildNoiseData(1)
with torch.no_grad():
    generated_image = model.test(noise)
    
# Now generated_image contains our generated image! 🌞
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment