Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -36,13 +36,9 @@ from e4e.models.psp import pSp
|
|
36 |
from util import *
|
37 |
from huggingface_hub import hf_hub_download
|
38 |
|
39 |
-
os.makedirs('models', exist_ok=True)
|
40 |
-
os.system("gdown https://drive.google.com/uc?id=1jtCg8HQ6RlTmLdnbT2PfW1FJ2AYkWqsK")
|
41 |
-
os.system("cp e4e_ffhq_encode.pt models/e4e_ffhq_encode.pt")
|
42 |
-
|
43 |
device= 'cpu'
|
44 |
-
|
45 |
-
ckpt = torch.load(
|
46 |
opts = ckpt['opts']
|
47 |
opts['checkpoint_path'] = model_path
|
48 |
opts= Namespace(**opts)
|
@@ -77,12 +73,12 @@ os.system("mv shape_predictor_68_face_landmarks.dat models/dlibshape_predictor_6
|
|
77 |
|
78 |
device = 'cpu'
|
79 |
|
80 |
-
os.system("gdown https://drive.google.com/uc?id=1_cTsjqzD_X9DK3t3IZE53huKgnzj_btZ")
|
81 |
|
82 |
latent_dim = 512
|
83 |
|
|
|
84 |
original_generator = Generator(1024, latent_dim, 8, 2).to(device)
|
85 |
-
ckpt = torch.load(
|
86 |
original_generator.load_state_dict(ckpt["g_ema"], strict=False)
|
87 |
mean_latent = original_generator.mean_latent(10000)
|
88 |
|
36 |
from util import *
|
37 |
from huggingface_hub import hf_hub_download
|
38 |
|
|
|
|
|
|
|
|
|
39 |
device= 'cpu'
|
40 |
+
model_path_e = hf_hub_download(repo_id="akhaliq/JoJoGAN_e4e_ffhq_encode", filename="e4e_ffhq_encode.pt")
|
41 |
+
ckpt = torch.load(model_path_e, map_location='cpu')
|
42 |
opts = ckpt['opts']
|
43 |
opts['checkpoint_path'] = model_path
|
44 |
opts= Namespace(**opts)
|
73 |
|
74 |
device = 'cpu'
|
75 |
|
|
|
76 |
|
77 |
latent_dim = 512
|
78 |
|
79 |
+
model_path_s = hf_hub_download(repo_id="akhaliq/jojogan-stylegan2-ffhq-config-f", filename="stylegan2-ffhq-config-f.pt")
|
80 |
original_generator = Generator(1024, latent_dim, 8, 2).to(device)
|
81 |
+
ckpt = torch.load(model_path_s, map_location=lambda storage, loc: storage)
|
82 |
original_generator.load_state_dict(ckpt["g_ema"], strict=False)
|
83 |
mean_latent = original_generator.mean_latent(10000)
|
84 |
|