Emaad commited on
Commit
b75e844
1 Parent(s): d8ffd20

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -5
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
- protein_image = process_image(protein_image, dataset, "protein")
58
- protein_image = protein_image > torch.median(protein_image)
59
- protein_image = protein_image[0, 0]
60
- protein_image = protein_image * 1.0
 
 
 
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