Spaces:
Runtime error
Runtime error
Ahsen Khaliq
commited on
Commit
•
221345e
1
Parent(s):
725cbde
Update e4e_projection.py
Browse files- e4e_projection.py +8 -7
e4e_projection.py
CHANGED
@@ -8,17 +8,18 @@ from argparse import Namespace
|
|
8 |
from e4e.models.psp import pSp
|
9 |
from util import *
|
10 |
|
11 |
-
|
12 |
-
model_path = 'models/e4e_ffhq_encode.pt'
|
13 |
-
ckpt = torch.load(model_path, map_location='cpu')
|
14 |
-
opts = ckpt['opts']
|
15 |
-
opts['checkpoint_path'] = model_path
|
16 |
-
opts= Namespace(**opts)
|
17 |
-
net = pSp(opts, device).eval().to(device)
|
18 |
|
19 |
@ torch.no_grad()
|
20 |
def projection(img, name, device='cuda'):
|
21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
transform = transforms.Compose(
|
24 |
[
|
|
|
8 |
from e4e.models.psp import pSp
|
9 |
from util import *
|
10 |
|
11 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
@ torch.no_grad()
|
14 |
def projection(img, name, device='cuda'):
|
15 |
|
16 |
+
model_path = 'models/e4e_ffhq_encode.pt'
|
17 |
+
ckpt = torch.load(model_path, map_location='cpu')
|
18 |
+
opts = ckpt['opts']
|
19 |
+
opts['checkpoint_path'] = model_path
|
20 |
+
opts= Namespace(**opts)
|
21 |
+
net = pSp(opts, device).eval().to(device)
|
22 |
+
|
23 |
|
24 |
transform = transforms.Compose(
|
25 |
[
|