Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -71,8 +71,8 @@ def process(query_img, state,
|
|
71 |
cfg = Config.fromfile(cfg_path)
|
72 |
width, height, _ = state['original_support_image'].shape
|
73 |
kp_src_np = np.array(state['kp_src']).copy().astype(np.float32)
|
74 |
-
kp_src_np[:, 0] = kp_src_np[:,0] / (width //
|
75 |
-
kp_src_np[:, 1] = kp_src_np[:,1] / (height //
|
76 |
kp_src_np = np.flip(kp_src_np, 1).copy()
|
77 |
kp_src_tensor = torch.tensor(kp_src_np).float()
|
78 |
preprocess = transforms.Compose([
|
@@ -296,7 +296,7 @@ with gr.Blocks() as demo:
|
|
296 |
state['kp_src'].clear()
|
297 |
state['original_support_image'] = np.array(support_img)[:, :, ::-1].copy()
|
298 |
width, height = support_img.size
|
299 |
-
support_img = support_img.resize((width //
|
300 |
return support_img, support_img, state
|
301 |
|
302 |
|
|
|
71 |
cfg = Config.fromfile(cfg_path)
|
72 |
width, height, _ = state['original_support_image'].shape
|
73 |
kp_src_np = np.array(state['kp_src']).copy().astype(np.float32)
|
74 |
+
kp_src_np[:, 0] = kp_src_np[:,0] / (width // 4) * cfg.model.encoder_config.img_size
|
75 |
+
kp_src_np[:, 1] = kp_src_np[:,1] / (height // 4) * cfg.model.encoder_config.img_size
|
76 |
kp_src_np = np.flip(kp_src_np, 1).copy()
|
77 |
kp_src_tensor = torch.tensor(kp_src_np).float()
|
78 |
preprocess = transforms.Compose([
|
|
|
296 |
state['kp_src'].clear()
|
297 |
state['original_support_image'] = np.array(support_img)[:, :, ::-1].copy()
|
298 |
width, height = support_img.size
|
299 |
+
support_img = support_img.resize((width // 4, width // 4), Image.Resampling.LANCZOS)
|
300 |
return support_img, support_img, state
|
301 |
|
302 |
|