Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -16,7 +16,7 @@ from monai.transforms import (
|
|
16 |
BUNDLE_NAME = 'spleen_ct_segmentation_v0.1.0'
|
17 |
BUNDLE_PATH = os.path.join(torch.hub.get_dir(), 'bundle', BUNDLE_NAME)
|
18 |
|
19 |
-
examples = ['examples/BRATS_485.nii.gz']
|
20 |
|
21 |
model, _, _ = bundle.load(
|
22 |
name = BUNDLE_NAME,
|
@@ -60,14 +60,14 @@ def predict(input_file, z_axis, model=model, device=device):
|
|
60 |
input_image = data['image'].numpy()
|
61 |
pred_image = data['pred'].cpu().detach().numpy()
|
62 |
|
63 |
-
input_t1_image = input_image[0, :, :, z_axis]
|
64 |
input_t1c_image = input_image[1, :, :, z_axis]
|
65 |
-
input_t2_image = input_image[2, :, :, z_axis]
|
66 |
-
input_flair_image = input_image[3, :, :, z_axis]
|
67 |
|
68 |
pred_1_image = pred_image[0, 0, :, :, z_axis]
|
69 |
-
pred_2_image = pred_image[0, 1, :, :, z_axis]
|
70 |
-
pred_3_image = pred_image[0, 2, :, :, z_axis]
|
71 |
|
72 |
return input_t1c_image, pred_1_image
|
73 |
|
@@ -81,7 +81,7 @@ iface = gr.Interface(
|
|
81 |
gr.Image(label='input image'),
|
82 |
gr.Image(label='segmentation')],
|
83 |
title='Segment Gliomas using MONAI',
|
84 |
-
examples=examples,
|
85 |
)
|
86 |
|
87 |
iface.launch()
|
|
|
16 |
BUNDLE_NAME = 'spleen_ct_segmentation_v0.1.0'
|
17 |
BUNDLE_PATH = os.path.join(torch.hub.get_dir(), 'bundle', BUNDLE_NAME)
|
18 |
|
19 |
+
#examples = ['examples/BRATS_485.nii.gz']
|
20 |
|
21 |
model, _, _ = bundle.load(
|
22 |
name = BUNDLE_NAME,
|
|
|
60 |
input_image = data['image'].numpy()
|
61 |
pred_image = data['pred'].cpu().detach().numpy()
|
62 |
|
63 |
+
#input_t1_image = input_image[0, :, :, z_axis]
|
64 |
input_t1c_image = input_image[1, :, :, z_axis]
|
65 |
+
#input_t2_image = input_image[2, :, :, z_axis]
|
66 |
+
#input_flair_image = input_image[3, :, :, z_axis]
|
67 |
|
68 |
pred_1_image = pred_image[0, 0, :, :, z_axis]
|
69 |
+
#pred_2_image = pred_image[0, 1, :, :, z_axis]
|
70 |
+
#pred_3_image = pred_image[0, 2, :, :, z_axis]
|
71 |
|
72 |
return input_t1c_image, pred_1_image
|
73 |
|
|
|
81 |
gr.Image(label='input image'),
|
82 |
gr.Image(label='segmentation')],
|
83 |
title='Segment Gliomas using MONAI',
|
84 |
+
#examples=examples,
|
85 |
)
|
86 |
|
87 |
iface.launch()
|