Add Hulk model
Browse files- app.py +13 -4
- assets/references/hulk/image01.jpg +0 -0
- assets/references/hulk/image02.jpg +0 -0
- assets/references/hulk/image03.jpg +0 -0
app.py
CHANGED
@@ -68,6 +68,7 @@ mean_latent = original_generator.mean_latent(10000)
|
|
68 |
|
69 |
#MODELS
|
70 |
generatorzombie = deepcopy(original_generator)
|
|
|
71 |
generatorjojo = deepcopy(original_generator)
|
72 |
|
73 |
transform = transforms.Compose(
|
@@ -78,6 +79,11 @@ transform = transforms.Compose(
|
|
78 |
]
|
79 |
)
|
80 |
|
|
|
|
|
|
|
|
|
|
|
81 |
|
82 |
#ZOMBIE
|
83 |
modelzombie = hf_hub_download(repo_id="Awesimo/jojogan-zombie", filename="zombie.pt")
|
@@ -94,9 +100,12 @@ def inference(img, model):
|
|
94 |
aligned_face = align_face('out.jpg')
|
95 |
|
96 |
my_w = projection(aligned_face, "test.pt", device).unsqueeze(0)
|
97 |
-
if model == '
|
98 |
with torch.no_grad():
|
99 |
-
my_sample =
|
|
|
|
|
|
|
100 |
elif model == 'JoJo':
|
101 |
with torch.no_grad():
|
102 |
my_sample = generatorjojo(my_w, input_is_latent=True)
|
@@ -110,5 +119,5 @@ def inference(img, model):
|
|
110 |
return 'filename.jpeg'
|
111 |
|
112 |
title = "JoJoGAN Test π€"
|
113 |
-
examples=[['assets/samples/image01.jpg','
|
114 |
-
gr.Interface(inference, [gr.inputs.Image(type="pil"),gr.inputs.Dropdown(choices=['Zombie', 'JoJo'], type="value", default='
|
|
|
68 |
|
69 |
#MODELS
|
70 |
generatorzombie = deepcopy(original_generator)
|
71 |
+
generatorhulk = deepcopy(original_generator)
|
72 |
generatorjojo = deepcopy(original_generator)
|
73 |
|
74 |
transform = transforms.Compose(
|
|
|
79 |
]
|
80 |
)
|
81 |
|
82 |
+
#HULK
|
83 |
+
modelhulk = hf_hub_download(repo_id="Awesimo/jojogan-hulk", filename="zombie.pt")
|
84 |
+
ckpthulk = torch.load(modelhulk, map_location=lambda storage, loc: storage)
|
85 |
+
generatorhulk.load_state_dict(ckpthulk["g"], strict=False)
|
86 |
+
|
87 |
|
88 |
#ZOMBIE
|
89 |
modelzombie = hf_hub_download(repo_id="Awesimo/jojogan-zombie", filename="zombie.pt")
|
|
|
100 |
aligned_face = align_face('out.jpg')
|
101 |
|
102 |
my_w = projection(aligned_face, "test.pt", device).unsqueeze(0)
|
103 |
+
if model == 'Hulk':
|
104 |
with torch.no_grad():
|
105 |
+
my_sample = generatorhulk(my_w, input_is_latent=True)
|
106 |
+
elif model == 'Zombie':
|
107 |
+
with torch.no_grad():
|
108 |
+
my_sample = generatorjojo(my_w, input_is_latent=True)
|
109 |
elif model == 'JoJo':
|
110 |
with torch.no_grad():
|
111 |
my_sample = generatorjojo(my_w, input_is_latent=True)
|
|
|
119 |
return 'filename.jpeg'
|
120 |
|
121 |
title = "JoJoGAN Test π€"
|
122 |
+
examples=[['assets/samples/image01.jpg','Hulk'],['assets/samples/image02.jpg','Zombie'],['assets/samples/image03.jpg','JoJo'],['assets/samples/image04.jpg','Hulk']]
|
123 |
+
gr.Interface(inference, [gr.inputs.Image(type="pil"),gr.inputs.Dropdown(choices=['Hulk', 'Zombie', 'JoJo'], type="value", default='Hulk', label="Model")], gr.outputs.Image(type="file"),title=title,allow_flagging=False,examples=examples,allow_screenshot=False).launch()
|
assets/references/hulk/image01.jpg
ADDED
![]() |
assets/references/hulk/image02.jpg
ADDED
![]() |
assets/references/hulk/image03.jpg
ADDED
![]() |