import torchvision
import runway
import numpy as np
@runway.setup(options={"checkpoint": runway.category(description="Pretrained checkpoints to use.",
choices=['celebAHQ-512', 'celebAHQ-256', 'celeba'],
default='celebAHQ-512')})
def setup(opts):
This file contains hidden or 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
import runway | |
from runway.data_types import number, text, image | |
import numpy as np | |
from scipy import ndimage | |
import time | |
@runway.command(name='convert', | |
inputs={ 'image': image }, | |
outputs={ 'image': image }) | |
def generate(model, inputs): |
This file contains hidden or 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
import runway | |
import torch | |
from transformers import BertTokenizer | |
from transformers import BertForNextSentencePrediction | |
from runway.data_types import array, text, number, boolean | |
# Setup block copy-pasted from Cris's tutorial | |
@runway.setup(options={"checkpoint": runway.category(description="Pretrained checkpoints to use.", | |
choices=['celebAHQ-512', 'celebAHQ-256', 'celeba'], |
This file contains hidden or 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
entrypoint: python runway_model.py | |
python: 3.6 | |
cuda: 9.0 | |
spec: | |
gpu: True | |
cpu: True | |
build_steps: | |
- pip install torch==1.1.0 runway-python numpy==1.16.4 |
import torch
import runway
import numpy as np
@runway.setup(options={"checkpoint": runway.category(description="Pretrained checkpoints to use.",
choices=['celebAHQ-512', 'celebAHQ-256', 'celeba'],
default='celebAHQ-512')})
def setup(opts):
import torch
import runway
import numpy as np
+ @runway.setup(options={"checkpoint": runway.category(description="Pretrained checkpoints to use.",
+ choices=['celebAHQ-512', 'celebAHQ-256', 'celeba'],
+ default='celebAHQ-512')})
+ def setup(opts):
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',
This file contains hidden or 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
## Sample code to generate an image using the | |
## pre-trained PGAN celebAHQ-512 checkpoint from the Pytorch Hub | |
import torch | |
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) |
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
This file contains hidden or 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
AD 42.546245 1.601554 Andorra | |
AE 23.424076 53.847818 United Arab Emirates | |
AF 33.93911 67.709953 Afghanistan | |
AG 17.060816 -61.796428 Antigua and Barbuda | |
AI 18.220554 -63.068615 Anguilla | |
AL 41.153332 20.168331 Albania | |
AM 40.069099 45.038189 Armenia | |
AN 12.226079 -69.060087 Netherlands Antilles | |
AO -11.202692 17.873887 Angola | |
AQ -75.250973 -0.071389 Antarctica |
This file contains hidden or 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
classifier.classify(someImage, gotResult); | |
function gotResult(labels) { | |
console.log(label); | |
} |
NewerOlder