katielink commited on
Commit
64ba3c6
·
1 Parent(s): c7af872

Update slider output in app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -8
app.py CHANGED
@@ -18,10 +18,12 @@ BUNDLE_PATH = os.path.join(torch.hub.get_dir(), 'bundle', BUNDLE_NAME)
18
 
19
  title = "Segment Brain Tumors with MONAI!"
20
  description = """
 
 
21
 
22
  """
23
 
24
- examples = 'examples/'
25
 
26
  model, _, _ = bundle.load(
27
  name = BUNDLE_NAME,
@@ -65,16 +67,16 @@ def predict(input_file, z_axis, model=model, device=device):
65
  input_image = data['image'].numpy()
66
  pred_image = data['pred'].cpu().detach().numpy()
67
 
68
- #input_t1_image = input_image[0, :, :, z_axis]
69
- input_t1c_image = input_image[1, :, :, z_axis]
70
  #input_t2_image = input_image[2, :, :, z_axis]
71
  #input_flair_image = input_image[3, :, :, z_axis]
72
 
73
- pred_1_image = pred_image[0, 0, :, :, z_axis]
74
- #pred_2_image = pred_image[0, 1, :, :, z_axis]
75
- #pred_3_image = pred_image[0, 2, :, :, z_axis]
76
 
77
- return input_t1c_image, pred_1_image, z_axis
78
 
79
 
80
  iface = gr.Interface(
@@ -89,7 +91,7 @@ iface = gr.Interface(
89
  gr.Slider(0, 200, label='z-axis', value=100)],
90
  title=title,
91
  description=description,
92
- examples=examples,
93
  )
94
 
95
  iface.launch()
 
18
 
19
  title = "Segment Brain Tumors with MONAI!"
20
  description = """
21
+ A pre-trained model for volumetric (3D) segmentation of brain tumor subregions from multimodal MRIs based on BraTS 2018 data.
22
+
23
 
24
  """
25
 
26
+ #examples = 'examples/'
27
 
28
  model, _, _ = bundle.load(
29
  name = BUNDLE_NAME,
 
67
  input_image = data['image'].numpy()
68
  pred_image = data['pred'].cpu().detach().numpy()
69
 
70
+ input_t1c_image = input_image[0, :, :, z_axis]
71
+ #input_t1_image = input_image[1, :, :, z_axis]
72
  #input_t2_image = input_image[2, :, :, z_axis]
73
  #input_flair_image = input_image[3, :, :, z_axis]
74
 
75
+ pred_tc_image = pred_image[0, 0, :, :, z_axis]
76
+ #pred_et_image = pred_image[0, 1, :, :, z_axis]
77
+ #pred_wt_image = pred_image[0, 2, :, :, z_axis]
78
 
79
+ return input_t1c_image, pred_tc_image, z_axis
80
 
81
 
82
  iface = gr.Interface(
 
91
  gr.Slider(0, 200, label='z-axis', value=100)],
92
  title=title,
93
  description=description,
94
+ #examples=examples,
95
  )
96
 
97
  iface.launch()