Update app.py
Browse files
app.py
CHANGED
@@ -51,13 +51,19 @@ class model:
|
|
51 |
|
52 |
else:
|
53 |
dataset = "HPA"
|
|
|
|
|
|
|
|
|
54 |
|
55 |
-
nucleus_image = process_image(nucleus_image, dataset, "nucleus")
|
56 |
if protein_image:
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
|
|
|
|
|
|
61 |
else:
|
62 |
protein_image = torch.ones((256, 256))
|
63 |
|
|
|
51 |
|
52 |
else:
|
53 |
dataset = "HPA"
|
54 |
+
|
55 |
+
to_tensor = T.ToTensor()
|
56 |
+
|
57 |
+
nucleus_tensor = to_tensor(nucleus_image)
|
58 |
|
|
|
59 |
if protein_image:
|
60 |
+
protein_tensor = to_tensor(protein_image)
|
61 |
+
stacked_images = torch.stack([nucleus_tensor, protein_tensor], dim=0)
|
62 |
+
processed_images = process_image(stacked_images, dataset)
|
63 |
+
nucleus_image = processed_images[0].unsqueeze(0)
|
64 |
+
protein_image = processed_images[1].unsqueeze(0)
|
65 |
+
protein_image = protein_image > 0
|
66 |
+
protein_image = 1.0 * protein_image
|
67 |
else:
|
68 |
protein_image = torch.ones((256, 256))
|
69 |
|