Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -68,7 +68,10 @@ def make_transform(translate: Tuple[float,float], angle: float):
|
|
| 68 |
|
| 69 |
#----------------------------------------------------------------------------
|
| 70 |
|
| 71 |
-
|
|
|
|
|
|
|
|
|
|
| 72 |
def generate_images(seeds):
|
| 73 |
"""Generate images using pretrained network pickle.
|
| 74 |
Examples:
|
|
@@ -82,9 +85,7 @@ def generate_images(seeds):
|
|
| 82 |
--network=https://api.ngc.nvidia.com/v2/models/nvidia/research/stylegan3/versions/1/files/stylegan3-t-metfacesu-1024x1024.pkl
|
| 83 |
"""
|
| 84 |
|
| 85 |
-
|
| 86 |
-
with dnnlib.util.open_url('https://s3.eu-central-1.amazonaws.com/avg-projects/projected_gan/models/pokemon.pkl') as f:
|
| 87 |
-
G = legacy.load_network_pkl(f)['G_ema'].to(device) # type: ignore
|
| 88 |
|
| 89 |
|
| 90 |
# Labels.
|
|
|
|
| 68 |
|
| 69 |
#----------------------------------------------------------------------------
|
| 70 |
|
| 71 |
+
device = torch.device('cuda') if torch.cuda.is_available() else torch.device('cpu')
|
| 72 |
+
with dnnlib.util.open_url('https://s3.eu-central-1.amazonaws.com/avg-projects/projected_gan/models/pokemon.pkl') as f:
|
| 73 |
+
G = legacy.load_network_pkl(f)['G_ema'].to(device) # type: ignore
|
| 74 |
+
|
| 75 |
def generate_images(seeds):
|
| 76 |
"""Generate images using pretrained network pickle.
|
| 77 |
Examples:
|
|
|
|
| 85 |
--network=https://api.ngc.nvidia.com/v2/models/nvidia/research/stylegan3/versions/1/files/stylegan3-t-metfacesu-1024x1024.pkl
|
| 86 |
"""
|
| 87 |
|
| 88 |
+
|
|
|
|
|
|
|
| 89 |
|
| 90 |
|
| 91 |
# Labels.
|