Update app.py
Browse files
app.py
CHANGED
|
@@ -99,12 +99,12 @@ class model:
|
|
| 99 |
|
| 100 |
|
| 101 |
nucleus_image = image['image'].convert('L')
|
| 102 |
-
protein_image = image['mask'].split()[3]
|
|
|
|
| 103 |
|
| 104 |
to_tensor = T.ToTensor()
|
| 105 |
nucleus_image = to_tensor(nucleus_image)
|
| 106 |
protein_image = to_tensor(protein_image)
|
| 107 |
-
#protein_image = protein_image
|
| 108 |
#stacked_images = torch.stack([nucleus_image, protein_image], dim=0)
|
| 109 |
#processed_images = process_image(stacked_images, dataset)
|
| 110 |
|
|
@@ -112,10 +112,12 @@ class model:
|
|
| 112 |
#protein_image = processed_images[1].unsqueeze(0)
|
| 113 |
#protein_image = protein_image/torch.max(protein_image)
|
| 114 |
#protein_image = 1 - protein_image
|
| 115 |
-
|
| 116 |
nucleus_image = nucleus_image.unsqueeze(0)
|
| 117 |
nucleus_image = process_image(nucleus_image, dataset, 'nucleus')
|
| 118 |
-
|
|
|
|
|
|
|
| 119 |
|
| 120 |
|
| 121 |
formatted_predicted_sequence = run_sequence_prediction(
|
|
@@ -168,13 +170,19 @@ with gr.Blocks(theme='gradio/soft') as demo:
|
|
| 168 |
)
|
| 169 |
|
| 170 |
with gr.Row().style(equal_height=True):
|
| 171 |
-
nucleus_image = gr.Image(
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 178 |
)
|
| 179 |
|
| 180 |
with gr.Row():
|
|
|
|
| 99 |
|
| 100 |
|
| 101 |
nucleus_image = image['image'].convert('L')
|
| 102 |
+
#protein_image = image['mask'].split()[3]
|
| 103 |
+
protein_image = image['mask'].convert('L')
|
| 104 |
|
| 105 |
to_tensor = T.ToTensor()
|
| 106 |
nucleus_image = to_tensor(nucleus_image)
|
| 107 |
protein_image = to_tensor(protein_image)
|
|
|
|
| 108 |
#stacked_images = torch.stack([nucleus_image, protein_image], dim=0)
|
| 109 |
#processed_images = process_image(stacked_images, dataset)
|
| 110 |
|
|
|
|
| 112 |
#protein_image = processed_images[1].unsqueeze(0)
|
| 113 |
#protein_image = protein_image/torch.max(protein_image)
|
| 114 |
#protein_image = 1 - protein_image
|
| 115 |
+
|
| 116 |
nucleus_image = nucleus_image.unsqueeze(0)
|
| 117 |
nucleus_image = process_image(nucleus_image, dataset, 'nucleus')
|
| 118 |
+
nucleus_image = nucleus_image.unsqueeze(0)
|
| 119 |
+
protein_image = protein_image.unsqueeze(0).unsqueeze(0)
|
| 120 |
+
#protein_image = 1.0*(protein_image > .01)
|
| 121 |
|
| 122 |
|
| 123 |
formatted_predicted_sequence = run_sequence_prediction(
|
|
|
|
| 170 |
)
|
| 171 |
|
| 172 |
with gr.Row().style(equal_height=True):
|
| 173 |
+
#nucleus_image = gr.Image(
|
| 174 |
+
# source="upload",
|
| 175 |
+
# tool="color-sketch",
|
| 176 |
+
# label="Nucleus Image",
|
| 177 |
+
# interactive=True,
|
| 178 |
+
# image_mode="RGBA",
|
| 179 |
+
# type="pil"
|
| 180 |
+
#)
|
| 181 |
+
nucleus_image = gr.ImageMask(
|
| 182 |
+
label = "Nucleus Image",
|
| 183 |
+
interactive = "True",
|
| 184 |
+
image_mode = "L",
|
| 185 |
+
brush_color = "#FFFFFF"
|
| 186 |
)
|
| 187 |
|
| 188 |
with gr.Row():
|