Spaces:
Running
Running
antoinedelplace
commited on
Commit
·
a8adc67
1
Parent(s):
4bac285
Fix fancy image size
Browse files
app.py
CHANGED
@@ -22,6 +22,7 @@ def transform_with_seed(input_img, transform, seed=123456):
|
|
22 |
|
23 |
def convert_he2ihc(input_he_image_path):
|
24 |
input_img = Image.open(input_he_image_path).convert('RGB')
|
|
|
25 |
|
26 |
opt = SimpleNamespace(
|
27 |
gpu_ids=None,
|
@@ -29,7 +30,7 @@ def convert_he2ihc(input_he_image_path):
|
|
29 |
checkpoints_dir="../../checkpoints",
|
30 |
# name="ASP_pretrained/BCI_her2_lambda_linear",
|
31 |
name="ASP_pretrained/BCI_her2_zero_uniform",
|
32 |
-
preprocess="
|
33 |
nce_layers="0,4,8,12,16",
|
34 |
nce_idt=False,
|
35 |
input_nc=3,
|
@@ -72,6 +73,7 @@ def convert_he2ihc(input_he_image_path):
|
|
72 |
visuals = model.get_current_visuals()
|
73 |
|
74 |
output_img = to_pil_image(visuals['fake_B'].detach().cpu().squeeze(0))
|
|
|
75 |
print("np.shape(output_img)", np.shape(output_img))
|
76 |
|
77 |
return output_img
|
|
|
22 |
|
23 |
def convert_he2ihc(input_he_image_path):
|
24 |
input_img = Image.open(input_he_image_path).convert('RGB')
|
25 |
+
original_img_size = input_img.size
|
26 |
|
27 |
opt = SimpleNamespace(
|
28 |
gpu_ids=None,
|
|
|
30 |
checkpoints_dir="../../checkpoints",
|
31 |
# name="ASP_pretrained/BCI_her2_lambda_linear",
|
32 |
name="ASP_pretrained/BCI_her2_zero_uniform",
|
33 |
+
preprocess="scale_width_and_crop",
|
34 |
nce_layers="0,4,8,12,16",
|
35 |
nce_idt=False,
|
36 |
input_nc=3,
|
|
|
73 |
visuals = model.get_current_visuals()
|
74 |
|
75 |
output_img = to_pil_image(visuals['fake_B'].detach().cpu().squeeze(0))
|
76 |
+
output_img = output_img.resize(original_img_size)
|
77 |
print("np.shape(output_img)", np.shape(output_img))
|
78 |
|
79 |
return output_img
|