Spaces:
Runtime error
Runtime error
fist version
Browse files
app.py
CHANGED
|
@@ -66,20 +66,14 @@ def make_transform(translate: Tuple[float,float], angle: float):
|
|
| 66 |
|
| 67 |
device = torch.device('cuda') if torch.cuda.is_available() else torch.device('cpu')
|
| 68 |
|
| 69 |
-
# config_file_url = hf_hub_url("autonomousvision/Projected_GAN_Pokemon", filename="pokemon.pkl")
|
| 70 |
-
# config_file_url = r'E:\桌面\Preparation of Papers for IEEE Signal Processing Letters (5-page limit)\codes\pokemon.pkl'
|
| 71 |
-
# with dnnlib.util.open_url(config_file_url) as f:
|
| 72 |
-
# G = legacy.load_network_pkl(f)['G_ema'].to(device) # type: ignore
|
| 73 |
|
| 74 |
# models = {
|
| 75 |
# 'pokemon':
|
| 76 |
# }
|
| 77 |
# base_path =
|
| 78 |
-
models = dict()
|
| 79 |
-
for i in ["pokemon", "art-paint", "flowers", "landscapes","obama"]:
|
| 80 |
-
|
| 81 |
-
with dnnlib.util.open_url(config_file_url) as f:
|
| 82 |
-
models[i] = legacy.load_network_pkl(f)['G_ema']
|
| 83 |
|
| 84 |
|
| 85 |
def generate_images(seeds, name):
|
|
@@ -95,7 +89,10 @@ def generate_images(seeds, name):
|
|
| 95 |
--network=https://api.ngc.nvidia.com/v2/models/nvidia/research/stylegan3/versions/1/files/stylegan3-t-metfacesu-1024x1024.pkl
|
| 96 |
"""
|
| 97 |
# models
|
| 98 |
-
|
|
|
|
|
|
|
|
|
|
| 99 |
# Labels.
|
| 100 |
label = torch.zeros([1, G.c_dim], device=device)
|
| 101 |
|
|
|
|
| 66 |
|
| 67 |
device = torch.device('cuda') if torch.cuda.is_available() else torch.device('cpu')
|
| 68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
|
| 70 |
# models = {
|
| 71 |
# 'pokemon':
|
| 72 |
# }
|
| 73 |
# base_path =
|
| 74 |
+
# models = dict()
|
| 75 |
+
# for i in ["pokemon", "art-paint", "flowers", "landscapes","obama"]:
|
| 76 |
+
|
|
|
|
|
|
|
| 77 |
|
| 78 |
|
| 79 |
def generate_images(seeds, name):
|
|
|
|
| 89 |
--network=https://api.ngc.nvidia.com/v2/models/nvidia/research/stylegan3/versions/1/files/stylegan3-t-metfacesu-1024x1024.pkl
|
| 90 |
"""
|
| 91 |
# models
|
| 92 |
+
config_file_url = hf_hub_url("ZJW666/Projected_GAN_CLC", filename=name+".pkl")
|
| 93 |
+
with dnnlib.util.open_url(config_file_url) as f:
|
| 94 |
+
G = legacy.load_network_pkl(f)['G_ema'].to(device)
|
| 95 |
+
# G = models[name].to(device)
|
| 96 |
# Labels.
|
| 97 |
label = torch.zeros([1, G.c_dim], device=device)
|
| 98 |
|