Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -81,16 +81,16 @@ if __name__ == "__main__":
|
|
81 |
|
82 |
device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu")
|
83 |
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
|
91 |
precision_scope = autocast
|
92 |
|
93 |
-
|
94 |
def start_tryon(human_img,garm_img):
|
95 |
#load human image
|
96 |
human_img = human_img['background'].convert("RGB").resize((768,1024))
|
|
|
81 |
|
82 |
device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu")
|
83 |
|
84 |
+
model = instantiate_from_config(config.model)
|
85 |
+
model.load_state_dict(torch.load(opt.ckpt, map_location="cpu")["state_dict"], strict=False)
|
86 |
+
model.cuda()
|
87 |
+
model.eval()
|
88 |
+
model = model.to(device)
|
89 |
+
sampler = DDIMSampler(model)
|
90 |
|
91 |
precision_scope = autocast
|
92 |
|
93 |
+
@spaces.GPU
|
94 |
def start_tryon(human_img,garm_img):
|
95 |
#load human image
|
96 |
human_img = human_img['background'].convert("RGB").resize((768,1024))
|