Spaces:
Runtime error
Runtime error
Commit
•
b56dcdb
1
Parent(s):
ddad699
Attempt #2
Browse files- .gitignore +1 -0
- app.py +7 -8
.gitignore
CHANGED
@@ -3,5 +3,6 @@ gradio_queue.db-journal
|
|
3 |
stylegan_xl
|
4 |
samples
|
5 |
flagged
|
|
|
6 |
*.pkl
|
7 |
*.mp4
|
|
|
3 |
stylegan_xl
|
4 |
samples
|
5 |
flagged
|
6 |
+
app_local.py
|
7 |
*.pkl
|
8 |
*.mp4
|
app.py
CHANGED
@@ -20,7 +20,7 @@ import torch.nn.functional as F
|
|
20 |
import requests
|
21 |
import torchvision.transforms as transforms
|
22 |
import torchvision.transforms.functional as TF
|
23 |
-
import clip
|
24 |
import unicodedata
|
25 |
import re
|
26 |
from tqdm.notebook import tqdm
|
@@ -46,7 +46,7 @@ def fetch(url_or_path):
|
|
46 |
return open(url_or_path, 'rb')
|
47 |
|
48 |
def fetch_model(url_or_path,network_name):
|
49 |
-
torch.hub.download_url_to_file(f'{url_or_path}',f'
|
50 |
|
51 |
def slugify(value, allow_unicode=False):
|
52 |
"""
|
@@ -133,16 +133,16 @@ clip_model = CLIP()
|
|
133 |
|
134 |
#@markdown #**Model selection** 🎭
|
135 |
|
136 |
-
Models = ["Imagenet256"
|
137 |
|
138 |
#@markdown ---
|
139 |
|
140 |
network_url = {
|
141 |
"Imagenet256":"https://s3.eu-central-1.amazonaws.com/avg-projects/stylegan_xl/models/imagenet256.pkl",
|
142 |
-
"Imagenet512": "https://s3.eu-central-1.amazonaws.com/avg-projects/stylegan_xl/models/imagenet512.pkl",
|
143 |
-
"Imagenet1024": "https://s3.eu-central-1.amazonaws.com/avg-projects/stylegan_xl/models/imagenet1024.pkl",
|
144 |
-
"Pokemon": "https://s3.eu-central-1.amazonaws.com/avg-projects/stylegan_xl/models/pokemon256.pkl",
|
145 |
-
"FFHQ": "https://s3.eu-central-1.amazonaws.com/avg-projects/stylegan_xl/models/ffhq256.pkl"
|
146 |
}
|
147 |
|
148 |
for Model in Models:
|
@@ -165,7 +165,6 @@ def load_current_model(current_model="Imagenet256.pkl"):
|
|
165 |
return(G,w_stds,w_all_classes_avg)
|
166 |
|
167 |
G, w_stds, w_all_classes_avg = load_current_model()
|
168 |
-
print(w_stds)
|
169 |
previousModel = 'imagenet256'
|
170 |
def run(prompt,steps,model):
|
171 |
global G, w_stds, w_all_classes_avg, previousModel
|
|
|
20 |
import requests
|
21 |
import torchvision.transforms as transforms
|
22 |
import torchvision.transforms.functional as TF
|
23 |
+
from CLIP import clip
|
24 |
import unicodedata
|
25 |
import re
|
26 |
from tqdm.notebook import tqdm
|
|
|
46 |
return open(url_or_path, 'rb')
|
47 |
|
48 |
def fetch_model(url_or_path,network_name):
|
49 |
+
torch.hub.download_url_to_file(f'{url_or_path}',f'{network_name}')
|
50 |
|
51 |
def slugify(value, allow_unicode=False):
|
52 |
"""
|
|
|
133 |
|
134 |
#@markdown #**Model selection** 🎭
|
135 |
|
136 |
+
Models = ["Imagenet256"]#, "Imagenet512", "Imagenet1024", "Pokemon", "FFHQ"]
|
137 |
|
138 |
#@markdown ---
|
139 |
|
140 |
network_url = {
|
141 |
"Imagenet256":"https://s3.eu-central-1.amazonaws.com/avg-projects/stylegan_xl/models/imagenet256.pkl",
|
142 |
+
#"Imagenet512": "https://s3.eu-central-1.amazonaws.com/avg-projects/stylegan_xl/models/imagenet512.pkl",
|
143 |
+
#"Imagenet1024": "https://s3.eu-central-1.amazonaws.com/avg-projects/stylegan_xl/models/imagenet1024.pkl",
|
144 |
+
#"Pokemon": "https://s3.eu-central-1.amazonaws.com/avg-projects/stylegan_xl/models/pokemon256.pkl",
|
145 |
+
#"FFHQ": "https://s3.eu-central-1.amazonaws.com/avg-projects/stylegan_xl/models/ffhq256.pkl"
|
146 |
}
|
147 |
|
148 |
for Model in Models:
|
|
|
165 |
return(G,w_stds,w_all_classes_avg)
|
166 |
|
167 |
G, w_stds, w_all_classes_avg = load_current_model()
|
|
|
168 |
previousModel = 'imagenet256'
|
169 |
def run(prompt,steps,model):
|
170 |
global G, w_stds, w_all_classes_avg, previousModel
|