Spaces:
Build error
Build error
Update app.py
Browse files
README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
emoji: 🧠
|
4 |
colorFrom: indigo
|
5 |
colorTo: red
|
|
|
1 |
---
|
2 |
+
title: Brain Tumor Segmentation
|
3 |
emoji: 🧠
|
4 |
colorFrom: indigo
|
5 |
colorTo: red
|
app.py
CHANGED
@@ -16,7 +16,9 @@ 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 |
-
|
|
|
|
|
20 |
|
21 |
model, _, _ = bundle.load(
|
22 |
name = BUNDLE_NAME,
|
@@ -69,7 +71,7 @@ def predict(input_file, z_axis, model=model, device=device):
|
|
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 |
|
74 |
iface = gr.Interface(
|
75 |
fn=predict,
|
@@ -79,9 +81,10 @@ iface = gr.Interface(
|
|
79 |
],
|
80 |
outputs=[
|
81 |
gr.Image(label='input image'),
|
82 |
-
gr.Image(label='segmentation')
|
83 |
-
|
84 |
-
|
|
|
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 = [
|
20 |
+
['examples/BRATS_485.nii.gz'],
|
21 |
+
]
|
22 |
|
23 |
model, _, _ = bundle.load(
|
24 |
name = BUNDLE_NAME,
|
|
|
71 |
#pred_2_image = pred_image[0, 1, :, :, z_axis]
|
72 |
#pred_3_image = pred_image[0, 2, :, :, z_axis]
|
73 |
|
74 |
+
return input_t1c_image, pred_1_image, z_axis
|
75 |
|
76 |
iface = gr.Interface(
|
77 |
fn=predict,
|
|
|
81 |
],
|
82 |
outputs=[
|
83 |
gr.Image(label='input image'),
|
84 |
+
gr.Image(label='segmentation'),
|
85 |
+
gr.Slider(0, 200, label='z-axis', value=100)],
|
86 |
+
title='Segment Brain Tumors using MONAI',
|
87 |
+
examples=examples,
|
88 |
)
|
89 |
|
90 |
iface.launch()
|