Spaces:
Runtime error
Runtime error
update app.py
Browse files
app.py
CHANGED
|
@@ -84,7 +84,7 @@ def load_sample(index):
|
|
| 84 |
for i in range(4):
|
| 85 |
image_filenames.append(f"thumbnails/image{index-1}_{i}.png")
|
| 86 |
|
| 87 |
-
sample = torch.load(f"samples/val{index-1}.pt")
|
| 88 |
#imgs = []
|
| 89 |
#for i in range(4):
|
| 90 |
# imgs.append(sample["image"][i, :, :, 70])
|
|
@@ -93,16 +93,20 @@ def load_sample(index):
|
|
| 93 |
#for i in range(4):
|
| 94 |
# pil_images.append(torchvision.transforms.functional.to_pil_image(imgs[i]))
|
| 95 |
|
| 96 |
-
imgs_label = []
|
| 97 |
-
for i in range(3):
|
| 98 |
-
|
| 99 |
|
| 100 |
-
|
| 101 |
for i in range(3):
|
| 102 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
|
| 104 |
return [index, image_filenames[0], image_filenames[1], image_filenames[2], image_filenames[3],
|
| 105 |
-
|
| 106 |
|
| 107 |
#return [index, pil_images[0], pil_images[1], pil_images[2], pil_images[3],
|
| 108 |
# pil_images_label[0], pil_images_label[1], pil_images_label[2]]
|
|
@@ -151,9 +155,14 @@ with gr.Blocks(title="Brain tumor 3D segmentation with MONAIMNIST - ClassCat",
|
|
| 151 |
"""
|
| 152 |
|
| 153 |
with gr.Row():
|
|
|
|
|
|
|
|
|
|
|
|
|
| 154 |
label_image0 = gr.Image(label="label channel 0", type="pil")
|
| 155 |
label_image1 = gr.Image(label="label channel 1", type="pil")
|
| 156 |
label_image2 = gr.Image(label="label channel 2", type="pil")
|
|
|
|
| 157 |
|
| 158 |
with gr.Row():
|
| 159 |
example1_btn = gr.Button("Example 1")
|
|
|
|
| 84 |
for i in range(4):
|
| 85 |
image_filenames.append(f"thumbnails/image{index-1}_{i}.png")
|
| 86 |
|
| 87 |
+
#sample = torch.load(f"samples/val{index-1}.pt")
|
| 88 |
#imgs = []
|
| 89 |
#for i in range(4):
|
| 90 |
# imgs.append(sample["image"][i, :, :, 70])
|
|
|
|
| 93 |
#for i in range(4):
|
| 94 |
# pil_images.append(torchvision.transforms.functional.to_pil_image(imgs[i]))
|
| 95 |
|
| 96 |
+
#imgs_label = []
|
| 97 |
+
#for i in range(3):
|
| 98 |
+
# imgs_label.append(sample["label"][i, :, :, 70])
|
| 99 |
|
| 100 |
+
label_filenames = []
|
| 101 |
for i in range(3):
|
| 102 |
+
label_filenames.append(f"thumbnails_label/label{index-1}_{i}.png")
|
| 103 |
+
|
| 104 |
+
#pil_images_label = []
|
| 105 |
+
#for i in range(3):
|
| 106 |
+
# pil_images_label.append(torchvision.transforms.functional.to_pil_image(imgs_label[i]))
|
| 107 |
|
| 108 |
return [index, image_filenames[0], image_filenames[1], image_filenames[2], image_filenames[3],
|
| 109 |
+
label_filenames[0], label_filenames[1], label_filenames[2]]
|
| 110 |
|
| 111 |
#return [index, pil_images[0], pil_images[1], pil_images[2], pil_images[3],
|
| 112 |
# pil_images_label[0], pil_images_label[1], pil_images_label[2]]
|
|
|
|
| 155 |
"""
|
| 156 |
|
| 157 |
with gr.Row():
|
| 158 |
+
label_image0 = gr.Image(label="label channel 0", type="filepath", shape=(240, 240))
|
| 159 |
+
label_image1 = gr.Image(label="label channel 1", type="filepath", shape=(240, 240))
|
| 160 |
+
label_image2 = gr.Image(label="label channel 2", type="filepath", shape=(240, 240))
|
| 161 |
+
"""
|
| 162 |
label_image0 = gr.Image(label="label channel 0", type="pil")
|
| 163 |
label_image1 = gr.Image(label="label channel 1", type="pil")
|
| 164 |
label_image2 = gr.Image(label="label channel 2", type="pil")
|
| 165 |
+
"""
|
| 166 |
|
| 167 |
with gr.Row():
|
| 168 |
example1_btn = gr.Button("Example 1")
|