rahulved
commited on
Commit
•
f6a5c7c
1
Parent(s):
becf3fa
Changed app.py
Browse files
app.py
CHANGED
@@ -9,6 +9,7 @@ import pickle
|
|
9 |
|
10 |
import torchvision.transforms as transforms
|
11 |
from PIL import Image
|
|
|
12 |
|
13 |
network_pkl_a = 'stylegan3-r-afhqv2-512x512.pkl'
|
14 |
network_pkl_d = 'network-snapshot.pkl'
|
@@ -17,9 +18,11 @@ with open(network_pkl_d, 'rb') as f:
|
|
17 |
|
18 |
with open(network_pkl_a, 'rb') as f:
|
19 |
G_a = pickle.load(f)['G_ema'].cpu() # torch.nn.Module
|
20 |
-
|
21 |
-
|
22 |
-
|
|
|
|
|
23 |
return gen_image_helper(G_d)
|
24 |
else:
|
25 |
return gen_image_helper(G_a)
|
|
|
9 |
|
10 |
import torchvision.transforms as transforms
|
11 |
from PIL import Image
|
12 |
+
import os
|
13 |
|
14 |
network_pkl_a = 'stylegan3-r-afhqv2-512x512.pkl'
|
15 |
network_pkl_d = 'network-snapshot.pkl'
|
|
|
18 |
|
19 |
with open(network_pkl_a, 'rb') as f:
|
20 |
G_a = pickle.load(f)['G_ema'].cpu() # torch.nn.Module
|
21 |
+
|
22 |
+
cl_text = os.getenv('SHOW_TEXT')
|
23 |
+
|
24 |
+
def gen_image(text):
|
25 |
+
if text==cl_text:
|
26 |
return gen_image_helper(G_d)
|
27 |
else:
|
28 |
return gen_image_helper(G_a)
|